From 44cc4d93e954cc552080ec4e306ada57e490894a Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 28 Jul 2024 00:09:57 +0000 Subject: [PATCH] Reformat (and only reformat) the inline assembly chapter The go forward plan adopted by T-spec on 2024-06-13 includes, as one step, to reformat all of the chapters of the Reference to attach named identifiers to each claim, more or less. The resulting text will use the `mdbook-spec` extension for rendering (see PR #1542). Adding these named identifiers more granularly throughout the document is one step in allowing the Reference to be used as a specification for Rust in safety-critical applications. Per our plan, we want to reformat one chapter first, to ensure our happiness with that and to perfect our process, and to then reformat (and review and merge those reformattings of) all of the rest of the Reference chapters in the same way. We discussed and imagined that this reformatting would be somewhat mechanical, and that it could be done by a technical writer with limited experience with Rust. This is what gave us confidence that this work could be hired out, completed, and reviewed on the months-scale timeline that we had set out. As a demonstration of the first step in that plan, this PR performs *only* reformatting. That is, we add identifiers to each claim, more or less, *and nothing else*. We change *none* of the verbiage in this chapter. Our finding is that doing things this way works out fine. The original text was already organized reasonably well enough to just leave it in place and add the identifiers. There's always more that could be done to improve a chapter. E.g., perhaps some claims could be broken down further still and more identifiers added, though there is a distinct readability tradeoff here. We've tried to strike a reasonable balance in this PR. The point of the exercise contained in this PR is that this diff is straightforward to review and moves us in the direction that we want to go. We can always make other changes later, and by separating them out, those changes will be easier to review also. Note that we're unhappy with the current rendering when two identifiers need to be stacked, e.g.: ``` [asm] [asm.intro] ``` We'll plan to improve this later and separately with work in `mdbook-spec` or in the style sheets. --- src/inline-assembly.md | 158 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 156 insertions(+), 2 deletions(-) diff --git a/src/inline-assembly.md b/src/inline-assembly.md index 56e170bb5..1167fa368 100644 --- a/src/inline-assembly.md +++ b/src/inline-assembly.md @@ -1,11 +1,15 @@ # Inline assembly +r[asm] + +r[asm.intro] Support for inline assembly is provided via the [`asm!`] and [`global_asm!`] macros. It can be used to embed handwritten assembly in the assembly output generated by the compiler. [`asm!`]: ../core/arch/macro.asm.html [`global_asm!`]: ../core/arch/macro.global_asm.html +r[asm.stable-targets] Support for inline assembly is stable on the following architectures: - x86 and x86-64 - ARM @@ -17,6 +21,8 @@ The compiler will emit an error if `asm!` is used on an unsupported target. ## Example +r[asm.example] + ```rust # #[cfg(target_arch = "x86_64")] { use std::arch::asm; @@ -39,6 +45,8 @@ assert_eq!(x, 4 * 6); ## Syntax +r[asm.syntax] + The following ABNF specifies the general syntax: ```text @@ -57,32 +65,53 @@ global_asm := "global_asm!(" format_string *("," format_string) *("," operand) [ ## Scope +r[asm.scope] + +r[asm.scope.intro] Inline assembly can be used in one of two ways. +r[asm.scope.asm] With the `asm!` macro, the assembly code is emitted in a function scope and integrated into the compiler-generated assembly code of a function. This assembly code must obey [strict rules](#rules-for-inline-assembly) to avoid undefined behavior. Note that in some cases the compiler may choose to emit the assembly code as a separate function and generate a call to it. +r[asm.scope.global_asm] With the `global_asm!` macro, the assembly code is emitted in a global scope, outside a function. This can be used to hand-write entire functions using assembly code, and generally provides much more freedom to use arbitrary registers and assembler directives. ## Template string arguments +r[asm.ts-args] + +r[asm.ts-args.syntax] The assembler template uses the same syntax as [format strings][format-syntax] (i.e. placeholders are specified by curly braces). + +r[asm.ts-args.order] The corresponding arguments are accessed in order, by index, or by name. + +r[asm.ts-args.no-implicit] However, implicit named arguments (introduced by [RFC #2795][rfc-2795]) are not supported. +r[asm.ts-args.one-or-more] An `asm!` invocation may have one or more template string arguments; an `asm!` with multiple template string arguments is treated as if all the strings were concatenated with a `\n` between them. The expected usage is for each template string argument to correspond to a line of assembly code. + +r[asm.ts-args.before-other-args] All template string arguments must appear before any other arguments. +r[asm.ts-args.positional-first] As with format strings, positional arguments must appear before named arguments and explicit [register operands](#register-operands). +r[asm.ts-args.register-operands] Explicit register operands cannot be used by placeholders in the template string. + +r[asm.ts-args.at-least-once] All other named and positional operands must appear at least once in the template string, otherwise a compiler error is generated. +r[asm.ts-args.opaque] The exact assembly code syntax is target-specific and opaque to the compiler except for the way operands are substituted into the template string to form the code passed to the assembler. +r[asm.ts-args.llvm-syntax] Currently, all supported targets follow the assembly code syntax used by LLVM's internal assembler which usually corresponds to that of the GNU assembler (GAS). On x86, the `.intel_syntax noprefix` mode of GAS is used by default. On ARM, the `.syntax unified` mode is used. @@ -95,56 +124,83 @@ Further constraints on the directives used by inline assembly are indicated by [ ## Operand type +r[asm.operand-type] + +r[asm.operand-type.supported-operands] Several types of operands are supported: +r[asm.operand-type.supported-operands.in] * `in() ` - `` can refer to a register class or an explicit register. The allocated register name is substituted into the asm template string. - The allocated register will contain the value of `` at the start of the asm code. - The allocated register must contain the same value at the end of the asm code (except if a `lateout` is allocated to the same register). + +r[asm.operand-type.supported-operands.out] * `out() ` - `` can refer to a register class or an explicit register. The allocated register name is substituted into the asm template string. - The allocated register will contain an undefined value at the start of the asm code. - `` must be a (possibly uninitialized) place expression, to which the contents of the allocated register are written at the end of the asm code. - An underscore (`_`) may be specified instead of an expression, which will cause the contents of the register to be discarded at the end of the asm code (effectively acting as a clobber). + +r[asm.operand-type.supported-operands.lateout] * `lateout() ` - Identical to `out` except that the register allocator can reuse a register allocated to an `in`. - You should only write to the register after all inputs are read, otherwise you may clobber an input. + +r[asm.operand-type.supported-operands.inout] * `inout() ` - `` can refer to a register class or an explicit register. The allocated register name is substituted into the asm template string. - The allocated register will contain the value of `` at the start of the asm code. - `` must be a mutable initialized place expression, to which the contents of the allocated register are written at the end of the asm code. + +r[asm.operand-type.supported-operands.inout-arrow] * `inout() => ` - Same as `inout` except that the initial value of the register is taken from the value of ``. - `` must be a (possibly uninitialized) place expression, to which the contents of the allocated register are written at the end of the asm code. - An underscore (`_`) may be specified instead of an expression for ``, which will cause the contents of the register to be discarded at the end of the asm code (effectively acting as a clobber). - `` and `` may have different types. + +r[asm.operand-type.supported-operands.inlateout] * `inlateout() ` / `inlateout() => ` - Identical to `inout` except that the register allocator can reuse a register allocated to an `in` (this can happen if the compiler knows the `in` has the same initial value as the `inlateout`). - You should only write to the register after all inputs are read, otherwise you may clobber an input. + +r[asm.operand-type.supported-operands.sym] * `sym ` - `` must refer to a `fn` or `static`. - A mangled symbol name referring to the item is substituted into the asm template string. - The substituted string does not include any modifiers (e.g. GOT, PLT, relocations, etc). - `` is allowed to point to a `#[thread_local]` static, in which case the asm code can combine the symbol with relocations (e.g. `@plt`, `@TPOFF`) to read from thread-local data. +r[asm.operand-type.left-to-right] Operand expressions are evaluated from left to right, just like function call arguments. After the `asm!` has executed, outputs are written to in left to right order. This is significant if two outputs point to the same place: that place will contain the value of the rightmost output. +r[asm.operand-type.global_asm-restriction] Since `global_asm!` exists outside a function, it can only use `sym` operands. ## Register operands +r[asm.register-operands] + +r[asm.register-operands.register-or-class] Input and output operands can be specified either as an explicit register or as a register class from which the register allocator can select a register. Explicit registers are specified as string literals (e.g. `"eax"`) while register classes are specified as identifiers (e.g. `reg`). +r[asm.register-operands.equivalence-to-base-register] Note that explicit registers treat register aliases (e.g. `r14` vs `lr` on ARM) and smaller views of a register (e.g. `eax` vs `rax`) as equivalent to the base register. + +r[asm.register-operands.error-two-operands] It is a compile-time error to use the same explicit register for two input operands or two output operands. + +r[asm.register-operands.error-overlapping] Additionally, it is also a compile-time error to use overlapping registers (e.g. ARM VFP) in input operands or in output operands. +r[asm.register-operands.allowed-types] Only the following types are allowed as operands for inline assembly: - Integers (signed and unsigned) - Floating-point numbers @@ -153,6 +209,7 @@ Only the following types are allowed as operands for inline assembly: - SIMD vectors (structs defined with `#[repr(simd)]` and which implement `Copy`). This includes architecture-specific vector types defined in `std::arch` such as `__m128` (x86) or `int8x16_t` (ARM). +r[asm.register-operands.supported-register-classes] Here is the list of currently supported register classes: | Architecture | Register class | Registers | LLVM constraint code | @@ -191,11 +248,10 @@ Here is the list of currently supported register classes: > **Notes**: > - On x86 we treat `reg_byte` differently from `reg` because the compiler can allocate `al` and `ah` separately whereas `reg` reserves the whole register. -> > - On x86-64 the high byte registers (e.g. `ah`) are not available in the `reg_byte` register class. -> > - Some register classes are marked as "Only clobbers" which means that registers in these classes cannot be used for inputs or outputs, only clobbers of the form `out() _` or `lateout() _`. +r[asm.register-operands.value-type-constraints] Each register class has constraints on which value types they can be used with. This is necessary because the way a value is loaded into a register depends on its type. For example, on big-endian systems, loading a `i32x4` and a `i8x16` into a SIMD register may result in different register contents even if the byte-wise memory representation of both values is identical. @@ -231,15 +287,20 @@ The availability of supported types for a particular register class may depend o > **Note**: For the purposes of the above table pointers, function pointers and `isize`/`usize` are treated as the equivalent integer type (`i16`/`i32`/`i64` depending on the target). +r[asm.register-operands.smaller-value] If a value is of a smaller size than the register it is allocated in then the upper bits of that register will have an undefined value for inputs and will be ignored for outputs. The only exception is the `freg` register class on RISC-V where `f32` values are NaN-boxed in a `f64` as required by the RISC-V architecture. +r[asm.register-operands.separate-input-output] When separate input and output expressions are specified for an `inout` operand, both expressions must have the same type. The only exception is if both operands are pointers or integers, in which case they are only required to have the same size. This restriction exists because the register allocators in LLVM and GCC sometimes cannot handle tied operands with different types. ## Register names +r[asm.register-names] + +r[asm.register-names.supported-register-aliases] Some registers have multiple names. These are all treated by the compiler as identical to the base register name. Here is the list of all supported register aliases: @@ -302,6 +363,7 @@ Here is the list of all supported register aliases: | LoongArch | `$f[8-23]` | `$ft[0-15]` | | LoongArch | `$f[24-31]` | `$fs[0-7]` | +r[asm.register-names.not-for-io] Some registers cannot be used for input or output operands: | Architecture | Unsupported register | Reason | @@ -321,14 +383,21 @@ Some registers cannot be used for input or output operands: | LoongArch | `$r2` or `$tp` | This is reserved for TLS. | | LoongArch | `$r21` | This is reserved by the ABI. | +r[asm.register-names.fp-bp-reserved] The frame pointer and base pointer registers are reserved for internal use by LLVM. While `asm!` statements cannot explicitly specify the use of reserved registers, in some cases LLVM will allocate one of these reserved registers for `reg` operands. Assembly code making use of reserved registers should be careful since `reg` operands may use the same registers. ## Template modifiers +r[asm.template-modifiers] + +r[asm.template-modifiers.intro] The placeholders can be augmented by modifiers which are specified after the `:` in the curly braces. These modifiers do not affect register allocation, but change the way operands are formatted when inserted into the template string. + +r[asm.template-modifiers.only-one] Only one modifier is allowed per template placeholder. +r[asm.template-modifiers.supported-modifiers] The supported modifiers are a subset of LLVM's (and GCC's) [asm template argument modifiers][llvm-argmod], but do not use the same letter codes. | Architecture | Register class | Modifier | Example output | LLVM modifier | @@ -375,6 +444,7 @@ The supported modifiers are a subset of LLVM's (and GCC's) [asm template argumen > GCC will infer the modifier based on the operand value type, while we default to the full register size. > - on x86 `xmm_reg`: the `x`, `t` and `g` LLVM modifiers are not yet implemented in LLVM (they are supported by GCC only), but this should be a simple change. +r[asm.template-modifiers.smaller-value] As stated in the previous section, passing an input value smaller than the register width will result in the upper bits of the register containing undefined values. This is not a problem if the inline asm only accesses the lower bits of the register, which can be done by using a template modifier to use a subregister name in the asm code (e.g. `ax` instead of `rax`). Since this an easy pitfall, the compiler will suggest a template modifier to use where appropriate given the input type. @@ -384,13 +454,22 @@ If all references to an operand already have modifiers then the warning is suppr ## ABI clobbers +r[asm.abi-clobbers] + +r[asm.abi-clobbers.intro] The `clobber_abi` keyword can be used to apply a default set of clobbers to an `asm!` block. This will automatically insert the necessary clobber constraints as needed for calling a function with a particular calling convention: if the calling convention does not fully preserve the value of a register across a call then `lateout("...") _` is implicitly added to the operands list (where the `...` is replaced by the register's name). +r[asm.abi-clobbers.many] `clobber_abi` may be specified any number of times. It will insert a clobber for all unique registers in the union of all specified calling conventions. +r[asm.abi-clobbers.must-specify] Generic register class outputs are disallowed by the compiler when `clobber_abi` is used: all outputs must specify an explicit register. + +r[asm.abi-clobbers.explicit-have-precedence] Explicit register outputs have precedence over the implicit clobbers inserted by `clobber_abi`: a clobber will only be inserted for a register if that register is not used as an output. + +r[asm.abi-clobbers.supported-abis] The following ABIs can be used with `clobber_abi`: | Architecture | ABI name | Clobbered registers | @@ -410,70 +489,117 @@ The list of clobbered registers for each ABI is updated in rustc as architecture ## Options +r[asm.options] + +r[asm.options.supported-options] Flags are used to further influence the behavior of the inline assembly block. Currently the following options are defined: + +r[asm.options.supported-options.pure] - `pure`: The `asm!` block has no side effects, must eventually return, and its outputs depend only on its direct inputs (i.e. the values themselves, not what they point to) or values read from memory (unless the `nomem` options is also set). This allows the compiler to execute the `asm!` block fewer times than specified in the program (e.g. by hoisting it out of a loop) or even eliminate it entirely if the outputs are not used. The `pure` option must be combined with either the `nomem` or `readonly` options, otherwise a compile-time error is emitted. + +r[asm.options.supported-options.nomem] - `nomem`: The `asm!` blocks does not read or write to any memory. This allows the compiler to cache the values of modified global variables in registers across the `asm!` block since it knows that they are not read or written to by the `asm!`. The compiler also assumes that this `asm!` block does not perform any kind of synchronization with other threads, e.g. via fences. + +r[asm.options.supported-options.readonly] - `readonly`: The `asm!` block does not write to any memory. This allows the compiler to cache the values of unmodified global variables in registers across the `asm!` block since it knows that they are not written to by the `asm!`. The compiler also assumes that this `asm!` block does not perform any kind of synchronization with other threads, e.g. via fences. + +r[asm.options.supported-options.preserves_flags] - `preserves_flags`: The `asm!` block does not modify the flags register (defined in the rules below). This allows the compiler to avoid recomputing the condition flags after the `asm!` block. + +r[asm.options.supported-options.noreturn] - `noreturn`: The `asm!` block never returns, and its return type is defined as `!` (never). Behavior is undefined if execution falls through past the end of the asm code. A `noreturn` asm block behaves just like a function which doesn't return; notably, local variables in scope are not dropped before it is invoked. + +r[asm.options.supported-options.nostack] - `nostack`: The `asm!` block does not push data to the stack, or write to the stack red-zone (if supported by the target). If this option is *not* used then the stack pointer is guaranteed to be suitably aligned (according to the target ABI) for a function call. + +r[asm.options.supported-options.att_syntax] - `att_syntax`: This option is only valid on x86, and causes the assembler to use the `.att_syntax prefix` mode of the GNU assembler. Register operands are substituted in with a leading `%`. + +r[asm.options.supported-options.raw] - `raw`: This causes the template string to be parsed as a raw assembly string, with no special handling for `{` and `}`. This is primarily useful when including raw assembly code from an external file using `include_str!`. +r[asm.options.checks] The compiler performs some additional checks on options: + +r[asm.options.checks.mutually-exclusive] - The `nomem` and `readonly` options are mutually exclusive: it is a compile-time error to specify both. + +r[asm.options.checks.pure] - It is a compile-time error to specify `pure` on an asm block with no outputs or only discarded outputs (`_`). + +r[asm.options.checks.noreturn] - It is a compile-time error to specify `noreturn` on an asm block with outputs. +r[asm.options.global_asm-restriction] `global_asm!` only supports the `att_syntax` and `raw` options. The remaining options are not meaningful for global-scope inline assembly ## Rules for inline assembly +r[asm.rules] + +r[asm.rules.intro] To avoid undefined behavior, these rules must be followed when using function-scope inline assembly (`asm!`): +r[asm.rules.reg-not-input] - Any registers not specified as inputs will contain an undefined value on entry to the asm block. - An "undefined value" in the context of inline assembly means that the register can (non-deterministically) have any one of the possible values allowed by the architecture. Notably it is not the same as an LLVM `undef` which can have a different value every time you read it (since such a concept does not exist in assembly code). + +r[asm.rules.reg-not-output] - Any registers not specified as outputs must have the same value upon exiting the asm block as they had on entry, otherwise behavior is undefined. - This only applies to registers which can be specified as an input or output. Other registers follow target-specific rules. - Note that a `lateout` may be allocated to the same register as an `in`, in which case this rule does not apply. Code should not rely on this however since it depends on the results of register allocation. + +r[asm.rules.unwind] - Behavior is undefined if execution unwinds out of an asm block. - This also applies if the assembly code calls a function which then unwinds. + +r[asm.rules.mem-same-as-ffi] - The set of memory locations that assembly code is allowed to read and write are the same as those allowed for an FFI function. - Refer to the unsafe code guidelines for the exact rules. - If the `readonly` option is set, then only memory reads are allowed. - If the `nomem` option is set then no reads or writes to memory are allowed. - These rules do not apply to memory which is private to the asm code, such as stack space allocated within the asm block. + +r[asm.rules.black-box] - The compiler cannot assume that the instructions in the asm are the ones that will actually end up executed. - This effectively means that the compiler must treat the `asm!` as a black box and only take the interface specification into account, not the instructions themselves. - Runtime code patching is allowed, via target-specific mechanisms. - However there is no guarantee that each `asm!` directly corresponds to a single instance of instructions in the object file: the compiler is free to duplicate or deduplicate `asm!` blocks. + +r[asm.rules.stack-below-sp] - Unless the `nostack` option is set, asm code is allowed to use stack space below the stack pointer. - On entry to the asm block the stack pointer is guaranteed to be suitably aligned (according to the target ABI) for a function call. - You are responsible for making sure you don't overflow the stack (e.g. use stack probing to ensure you hit a guard page). - You should adjust the stack pointer when allocating stack memory as required by the target ABI. - The stack pointer must be restored to its original value before leaving the asm block. + +r[asm.rules.noreturn] - If the `noreturn` option is set then behavior is undefined if execution falls through to the end of the asm block. + +r[asm.rules.pure] - If the `pure` option is set then behavior is undefined if the `asm!` has side-effects other than its direct outputs. Behavior is also undefined if two executions of the `asm!` code with the same inputs result in different outputs. - When used with the `nomem` option, "inputs" are just the direct inputs of the `asm!`. - When used with the `readonly` option, "inputs" comprise the direct inputs of the `asm!` and any memory that the `asm!` block is allowed to read. + +r[asm.rules.preserved-registers] - These flags registers must be restored upon exiting the asm block if the `preserves_flags` option is set: - x86 - Status flags in `EFLAGS` (CF, PF, AF, ZF, SF, OF). @@ -494,10 +620,16 @@ To avoid undefined behavior, these rules must be followed when using function-sc - Vector extension state (`vtype`, `vl`, `vcsr`). - LoongArch - Floating-point condition flags in `$fcc[0-7]`. + +r[asm.rules.x86-df] - On x86, the direction flag (DF in `EFLAGS`) is clear on entry to an asm block and must be clear on exit. - Behavior is undefined if the direction flag is set on exiting an asm block. + +r[asm.rules.x86-x87] - On x86, the x87 floating-point register stack must remain unchanged unless all of the `st([0-7])` registers have been marked as clobbered with `out("st(0)") _, out("st(1)") _, ...`. - If all x87 registers are clobbered then the x87 register stack is guaranteed to be empty upon entering an `asm` block. Assembly code must ensure that the x87 register stack is also empty when exiting the asm block. + +r[asm.rules.only-on-exit] - The requirement of restoring the stack pointer and non-output registers to their original value only applies when exiting an `asm!` block. - This means that `asm!` blocks that never return (even if not marked `noreturn`) don't need to preserve these registers. - When returning to a different `asm!` block than you entered (e.g. for context switching), these registers must contain the value they had upon entering the `asm!` block that you are *exiting*. @@ -506,16 +638,26 @@ To avoid undefined behavior, these rules must be followed when using function-sc - You are responsible for switching any target-specific state (e.g. thread-local storage, stack bounds). - You cannot jump from an address in one `asm!` block to an address in another, even within the same function or block, without treating their contexts as potentially different and requiring context switching. You cannot assume that any particular value in those contexts (e.g. current stack pointer or temporary values below the stack pointer) will remain unchanged between the two `asm!` blocks. - The set of memory locations that you may access is the intersection of those allowed by the `asm!` blocks you entered and exited. + +r[asm.rules.not-successive] - You cannot assume that two `asm!` blocks adjacent in source code, even without any other code between them, will end up in successive addresses in the binary without any other instructions between them. + +r[asm.rules.not-exactly-once] - You cannot assume that an `asm!` block will appear exactly once in the output binary. The compiler is allowed to instantiate multiple copies of the `asm!` block, for example when the function containing it is inlined in multiple places. + +r[asm.rules.x86-prefix-restriction] - On x86, inline assembly must not end with an instruction prefix (such as `LOCK`) that would apply to instructions generated by the compiler. - The compiler is currently unable to detect this due to the way inline assembly is compiled, but may catch and reject this in the future. +r[asm.rules.preserves_flags] > **Note**: As a general rule, the flags covered by `preserves_flags` are those which are *not* preserved when performing a function call. ### Correctness and Validity +r[asm.validity] + +r[asm.validity.necessary-but-not-sufficient] In addition to all of the previous rules, the string argument to `asm!` must ultimately become--- after all other arguments are evaluated, formatting is performed, and operands are translated--- assembly that is both syntactically correct and semantically valid for the target architecture. @@ -529,6 +671,7 @@ both correct and valid. For instance: - an architecturally unspecified instruction may be assembled into unspecified code - a set of instructions, each correct and valid, may cause undefined behavior if placed in immediate succession +r[asm.validity.non-exhaustive] As a result, these rules are _non-exhaustive_. The compiler is not required to check the correctness and validity of the initial string nor the final assembly that is generated. The assembler may check for correctness and validity but is not required to do so. @@ -539,11 +682,16 @@ assuming the responsibility of not violating rules of both the compiler or the a ### Directives Support +r[asm.directives] + +r[asm.directives.subset-supported] Inline assembly supports a subset of the directives supported by both GNU AS and LLVM's internal assembler, given as follows. The result of using other directives is assembler-specific (and may cause an error, or may be accepted as-is). +r[asm.directives.stateful] 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. +r[asm.directives.supported-directives] The following directives are guaranteed to be supported by the assembler: - `.2byte` @@ -599,8 +747,11 @@ The following directives are guaranteed to be supported by the assembler: #### Target Specific Directive Support +r[asm.target-specific-directives] + ##### Dwarf Unwinding +r[asm.target-specific-directives.dwarf-unwinding] The following directives are supported on ELF targets that support DWARF unwind info: @@ -629,6 +780,7 @@ The following directives are supported on ELF targets that support DWARF unwind ##### Structured Exception Handling +r[asm.target-specific-directives.structured-exception-handling] On targets with structured exception Handling, the following additional directives are guaranteed to be supported: - `.seh_endproc` @@ -642,6 +794,7 @@ On targets with structured exception Handling, the following additional directiv ##### x86 (32-bit and 64-bit) +r[asm.target-specific-directives.x86] On x86 targets, both 32-bit and 64-bit, the following additional directives are guaranteed to be supported: - `.nops` - `.code16` @@ -656,6 +809,7 @@ Use of `.code16`, `.code32`, and `.code64` directives are only supported if the ##### ARM (32-bit) +r[asm.target-specific-directives.arm-32-bit] On ARM, the following additional directives are guaranteed to be supported: - `.even`