global_asm!
should document that it doesn't guarantee section placement
#138247
Labels
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
A-inline-assembly
Area: Inline assembly (`asm!(…)`)
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
Location
https://doc.rust-lang.org/stable/core/arch/macro.global_asm.html
Summary
Ran into a surprising bug today -
global_asm!
stuck some executable code into.rodata
under release mode. The fix was simple - just needed to add a.section .text
directive, but was surprising and neither the docs nor the book seem to mention this (maybe I missed it).I documented my findings here: https://github.com/oro-os/development-notes/blob/master/Development%20Notes/x86/Scheduler%20Refactor%20(Mar%20'25).md#9-march-2025-fun-with-global_asm-linkage
Would you accept a PR to add a note about this?
The text was updated successfully, but these errors were encountered: