www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16300] New: Add pragma(section, "section-name") to place


          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 puremagic.com
          Reporter: code dawg.eu

This pragma should work similar to gcc's
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
- 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

TODO: Check whether proposed semantics are portable to Windows.
TODO: Convert to DIP if design becomes more complex.

Jul 20 2016