[Issue 16300] New: Add pragma(section, "section-name") to place data/functions in a particular section
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Jul 20 00:38:20 PDT 2016
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: nobody at puremagic.com
Reporter: code at 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.
--
More information about the Digitalmars-d-bugs
mailing list