You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/inline-assembly.md
+39-40Lines changed: 39 additions & 40 deletions
Original file line number
Diff line number
Diff line change
@@ -87,7 +87,7 @@ On x86, the `.intel_syntax noprefix` mode of GAS is used by default.
87
87
On ARM, the `.syntax unified` mode is used.
88
88
These targets impose an additional restriction on the assembly code: any assembler state (e.g. the current section which can be changed with `.section`) must be restored to its original value at the end of the asm string.
89
89
Assembly code that does not conform to the GAS syntax will result in assembler-specific behavior.
90
-
Further constraints on the directives used by inline assembly are indicated by [Directives Support](#directives-support).
90
+
Further constraints on the directives used by the assembly are indicated by [Directives Support](#directives-support).
@@ -481,70 +481,65 @@ To avoid undefined behavior, these rules must be followed when using function-sc
481
481
482
482
### Directives Support
483
483
484
-
Inline assembly supports a subset of the directives supported by both GNU AS and LLVM's internal assembler, given as follows.
484
+
Inline ASM supports a subset of the directives supported by both GNU AS and LLVM's internal assembler, given as follows.
485
485
The result of using other directives is assembler-specific (and may cause an error, or may be accepted as-is).
486
486
487
-
If inline assembly includes any "stateful" directive that modifies how subsequent assembly is processed, the block must undo the effects of any such directives before the inline assembly ends.
488
-
489
487
The following directives are guaranteed to be supported by the assembler:
490
488
491
489
492
490
-`.2byte`
493
491
-`.4byte`
494
492
-`.8byte`
495
-
-`.byte`
496
-
-`.short`
497
-
-`.word`
498
-
-`.long`
499
-
-`.quad`
500
-
-`.float`
501
-
-`.double`
502
-
-`.octa`
503
-
-`.sleb128`
504
-
-`.uleb128`
493
+
-`.align`
505
494
-`.ascii`
506
495
-`.asciz`
507
-
-`.string`
508
-
-`.skip`
509
-
-`.space`
510
496
-`.balign`
511
497
-`.balignl`
512
498
-`.balignw`
513
499
-`.balign`
514
500
-`.balignl`
515
501
-`.balignw`
516
-
-`.fill`
517
-
-`.section`
518
-
-`.pushsection`
519
-
-`.popsection`
520
-
-`.subsection`
521
-
-`.text`
522
502
-`.bss`
503
+
-`.byte`
504
+
-`.comm`
523
505
-`.data`
524
506
-`.def`
507
+
-`.double`
525
508
-`.endef`
526
-
-`.scl`
527
-
-`.comm`
528
-
-`.lcomm`
529
-
-`.option`
530
509
-`.equ`
531
510
-`.equiv`
532
511
-`.eqv`
533
-
-`.set`
534
-
-`.align`
512
+
-`.fill`
513
+
-`.float`
514
+
-`.lcomm`
535
515
-`.inst`
516
+
-`.long`
517
+
-`.octa`
518
+
-`.option`
536
519
-`.p2align`
537
-
-`.bundle_align_mode`
538
-
-`.bundle_lock`
539
-
-`.bundle_unlock`
540
-
-`.symver`
520
+
-`.pushsection`
521
+
-`.popsection`
522
+
-`.quad`
523
+
-`.scl`
524
+
-`.section`
525
+
-`.set`
526
+
-`.short`
527
+
-`.skip`
528
+
-`.sleb128`
529
+
-`.space`
530
+
-`.string`
531
+
-`.text`
532
+
-`.uleb128`
533
+
-`.word`
534
+
535
+
541
536
542
537
The following directives are guaranteed to be supported for `global_asm` only:
543
538
544
539
-`.alt_entry`
545
-
-`.private_extern`
546
540
-`.globl`
547
541
-`.global`
542
+
-`.private_extern`
548
543
-`.size`
549
544
-`.type`
550
545
@@ -592,18 +587,21 @@ On targets with structured exception Handling, the following additional directiv
592
587
-`.seh_stackalloc`
593
588
594
589
595
-
##### x86 (32-bit and 64-bit)
590
+
##### x86
596
591
597
-
On x86 targets, both 32-bit and 64-bit, the following additional directives are guaranteed to be supported:
592
+
On x86, the following additional directives are guaranteed to be supported:
593
+
-`.att_syntax`
594
+
-`.intel_syntax`
598
595
-`.nops`
599
596
600
-
On x86 for `global_asm!` only, the following additional directives are guaranteed to be supported (it is unspecified whether `.code16`or `.code32` are supported for `asm!()`):
597
+
Use of the `.att_syntax` and `.intel_syntax` with no parameters is supported, but the syntax must be restored to the option at entry (`.intel_syntax` without the `att_syntax` asm option, or `.att_syntax` with that option) or the behaviour is undefined (the output of the compiler may be corrupted as a result). Use of `.att_syntax` and `.intel_syntax` with an option (such as `.intel_syntax prefix` or `.att_syntax noprefix`) is unsupported and results in assembler-dependant behaviour.
601
598
599
+
On x86 for `global_asm!` only, the following additional directives are guaranteed to be supported:
602
600
-`.code16`
603
601
-`.code32`
604
602
605
603
606
-
##### ARM
604
+
##### ARM (32-bit only)
607
605
608
606
On ARM for `global_asm!` only, the following additional directives are guaranteed to be supported:
609
607
@@ -614,8 +612,9 @@ On ARM for `global_asm!` only, the following additional directives are guarantee
614
612
615
613
On ARM, the following additional directives are guaranteed to be supported:
0 commit comments