https://issues.dlang.org/show_bug.cgi?id=16300
Issue ID: 16300 Summary: Add pragma(section, "section-name") to place data/functions in a particular section Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: c...@dawg.eu This pragma should work similar to gcc's __attribute__((section("section-name"))). Placing data or functions into special sections is often required for memory-mapped I/O, but also useful to compactly gather metadata (e.g. ModuleInfo, issue 14472, or precise GC metadata). The pragma should have the following semantics. - It can be used for functions and data. - Mixing functions and data in a single section during one compilation could emit a warning (but what happens is up to the linker for separate compilation anyhow). - Alignment of a section should be the maximum alignment of any variable placed therein (this guarantees compact storage of 1-byte aligned data, but obeys alignment for e.g. SIMD data) - The section name should not be restricted (leave errors to the linker) semantics w/ question mark: - A section can be marked as bss if all of it's variables are zero initializable. TODO: Check whether proposed semantics are portable to Windows. TODO: Convert to DIP if design becomes more complex. --