Skip to content

Commit dad8233

Browse files
authored
Merge pull request #1441 from Amanieu/asm-dedup
Clarify that `asm!` blocks can be duplicated or deduplicated by the compiler
2 parents aa99472 + 6637d6e commit dad8233

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Diff for: src/inline-assembly.md

+1
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)