@@ -117,6 +117,41 @@ r[abi.link_section.edition2024]
117117> [ !EDITION-2024]
118118> Before the 2024 edition it is allowed to use the ` link_section ` attribute without the ` unsafe ` qualification.
119119
120+ r[ abi.link_section.format]
121+ The format of the ` link_section ` attribute is platform-specific, and the
122+ supported options varies depending on the underlying object file format.
123+
124+ r[ abi.link_section.mach-o]
125+ ### Link section Mach-O format
126+
127+ <!-- Parsing done by LLVM in https://github.com/llvm/llvm-project/blob/llvmorg-22.1.3/llvm/lib/MC/MCSectionMachO.cpp -->
128+ r[ abi.link_section.mach-o.syntax]
129+ ``` grammar,attributes
130+ MachOLinkSection -> MachOSegment `,` MachOSection (`,` (MachOSectionType (`,` MachOSectionAttributes?)?)?)?
131+
132+ MachOLinkSectionStub -> MachOSegment `,` MachOSection `,` `symbol_stubs` `,` MachOSectionAttributes? `,` MachOSectionStubSize
133+
134+ MachOSegment -> <0 to 16 bytes>
135+
136+ MachOSection -> <1 to 16 bytes>
137+
138+ MachOSectionType -> `regular` | `zerofill` | `cstring_literals` | `4byte_literals` | `8byte_literals` | `literal_pointers` | `non_lazy_symbol_pointers` | `lazy_symbol_pointers` | `mod_init_funcs` | `mod_term_funcs` | `coalesced` | `interposing` | `16byte_literals` | `thread_local_regular` | `thread_local_zerofill` | `thread_local_variables` | `thread_local_variable_pointers` | `thread_local_init_function_pointers`
139+
140+ MachOSectionAttributes -> MachOSectionAttribute (`+` MachOSectionAttribute)*
141+
142+ MachOSectionAttribute -> `pure_instructions` | `no_toc` | `strip_static_syms` | `no_dead_strip` | `live_support`, `self_modifying_code` | `debug`
143+
144+ MachOSectionStubSize -> DEC_DIGIT (DEC_DIGIT)*
145+ ```
146+
147+ r[ abi.link_section.mach-o.intro]
148+ The link section format string on Mach-O has five configurable fields: the
149+ segment, the section, the section type, the section attributes and the stub
150+ size.
151+
152+ r[ abi.link_section.mach-o.default-type]
153+ The section type defaults to ` regular ` if not set.
154+
120155r[ abi.export_name]
121156## The ` export_name ` attribute
122157
0 commit comments