[Accepted with modifications] SE-0492: Section Placement Control

Hello Swift Community,

The review of SE-0492 "Section Placement Control" concluded on October 14, 2025. The proposal is accepted with a few small modifications discussed during the review:

  • The #if condition objectFileFormat has been changed to objectFormat.
  • The use of lazy has been removed from the proposal. Something like it could be considered in the future.

The extended review considered whether to adopt a syntax for section control that included labeled arguments for each of the object formats, e.g., @section(ELF: "...", COFF: "...", MachO: "..."). Based on the subsequent discussion, the LSG opted not to pursue this direction at this time, but notes that it could be considered in the future if it will provide sufficient benefits.

Thank you,
Doug Gregor
Review Manager

16 Likes

For anyone following this thread: the "unified runtime API for reading section contents" that SE-0492 lists under Future Directions is now pitched separately, as [Pitch] Runtime enumeration of custom sections. It proposes one runtime entry point that returns a named section's contents from every loaded image on each object format, with an observer for images loaded later, and comes with a library prototype (swift-sections) that shows how far a library can get today and where only the toolchain can help, in particular on ELF, where the swift5_sections index described in SE-0492 is not emitted by the 6.4 toolchain. Feedback is welcome in the pitch thread.

1 Like