Bug 16300 – Add pragma(section, "section-name") to place data/functions in a particular section

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-07-20T07:38:20Z
Last change time
2024-12-13T18:48:58Z
Assigned to
No Owner
Creator
Martin Nowak
Moved to GitHub: dmd#17765 →

Comments

Comment #0 by code — 2016-07-20T07:38:20Z
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
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17765 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB