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.
Comment #1 by robert.schadek — 2024-12-13T18:48:58Z