https://sourceware.org/bugzilla/show_bug.cgi?id=26404
--- Comment #6 from Fangrui Song <i at maskray dot me> --- I try to incorporate the previous ideas. A concrete proposal: Add --overwrite-script=<scriptfile> scriptfile defines multiple SECTIONS commands. Each SECTIONS defines exactly an output section (for the first implementation we make the scope as narrow as possible). SECTIONS { .foo : { KEEP(*(.foo)) } /* Having another output section is disallowed. It is unclear whether the order here imposes a real output section order. */ /* Having a symbol assignment is disallowed. It is unclear whether the symbol assignment and the output section have interaction. */ } SECTIONS { .bar : { start_bar = .; *(.bar); stop_bar = .; } } If the main script defines .foo, its .foo is overwritten; if the main script does not define .foo, the new .foo is inserted as an orphan (the regular orphan placement rule applies). .bar is similar. The placement order of the two SECTIONS commands does not imply the section order. -- You are receiving this mail because: You are on the CC list for the bug.