Skip to content

Commit 6637d6e

Browse files
committed
Clarify that asm! blocks can be duplicated or deduplicated by the compiler
1 parent f9f5b5b commit 6637d6e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/inline-assembly.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ To avoid undefined behavior, these rules must be followed when using function-sc
463463
- The compiler cannot assume that the instructions in the asm are the ones that will actually end up executed.
464464
- 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.
465465
- Runtime code patching is allowed, via target-specific mechanisms.
466+
- 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.
466467
- Unless the `nostack` option is set, asm code is allowed to use stack space below the stack pointer.
467468
- On entry to the asm block the stack pointer is guaranteed to be suitably aligned (according to the target ABI) for a function call.
468469
- You are responsible for making sure you don't overflow the stack (e.g. use stack probing to ensure you hit a guard page).

0 commit comments

Comments
 (0)