[ELF] Allow SHF_LINK_ORDER sections to have sh_link=0
Part of https://bugs.llvm.org/show_bug.cgi?id=41734 The semantics of SHF_LINK_ORDER have been extended to represent metadata sections associated with some other sections (usually text). The associated text section may be discarded (e.g. LTO) and we want the metadata section to have sh_link=0 (D72899, D76802). Normally the metadata section is only referenced by the associated text section. sh_link=0 means the associated text section is discarded, and the metadata section will be garbage collected. If there is another section (.gc_root) referencing the metadata section, the metadata section will be retained. It's the .gc_root consumer's job to validate the metadata sections. # This creates a SHF_LINK_ORDER .meta with sh_link=0 .section .meta,"awo",@progbits,0 1: .section .meta,"awo",@progbits,foo 2: .section .gc_root,"a",@progbits .quad 1b .quad 2b Reviewed By: pcc, jhenderson Differential Revision: https://reviews.llvm.org/D72904
Loading
Please sign in to comment