This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
SHF_LINK_ORDER and --gc-sections
- From: Fangrui Song <i at maskray dot me>
- To: binutils at sourceware dot org
- Date: Tue, 19 Nov 2019 20:33:08 -0800
- Subject: SHF_LINK_ORDER and --gc-sections
This ELF spec says very little about SHF_LINK_ORDER http://www.sco.com/developers/gabi/latest/ch4.sheader.html#special_sections :
SHF_LINK_ORDER
This flag adds special ordering requirements for link editors. The requirements apply if the sh_link field of this section's header references another section (the linked-to section). If this section is combined with other sections in the output file, it must appear in the same relative order with respect to those sections, as the linked-to section appears with respect to sections the linked-to section is combined with.
In
https://groups.google.com/forum/#!msg/generic-abi/_CbBM6T6WeM/9nNnwRNHAQAJ ,
people reached consensus that we should extend the semantics of
SHF_LINK_ORDER (underexploited before, but gains some usage recently for
metadata) to interact better with garbage collection. The idea was
implemented in lld. Below are the cases that I find GNU ld and lld
differ. Each issue can be seen as a feature request:)
Generalize GC support for SHF_LINK_ORDER
https://sourceware.org/bugzilla/show_bug.cgi?id=24526
Garbage collecting non-alloc SHF_LINK_ORDER sections
https://sourceware.org/bugzilla/show_bug.cgi?id=25021
Make /DISCARD/ discard SHF_LINK_ORDER sections
https://sourceware.org/bugzilla/show_bug.cgi?id=25022