llvm-project/lld/ELF
Fangrui Song b216c80cc2 [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
2020-08-05 16:17:42 -07:00
..
Arch [PowerPC] Support for R_PPC64_REL24_NOTOC calls where the caller has no TOC and the callee is not DSO local 2020-07-29 19:49:28 +00:00
AArch64ErrataFix.cpp [ELF] Use namespace qualifiers (lld:: or elf::) instead of `namespace lld { namespace elf {` 2020-05-15 08:49:53 -07:00
AArch64ErrataFix.h [ELF] Fix variable names in comments after VariableName -> variableName change 2019-07-16 05:50:45 +00:00
ARMErrataFix.cpp [ELF] Use namespace qualifiers (lld:: or elf::) instead of `namespace lld { namespace elf {` 2020-05-15 08:49:53 -07:00
ARMErrataFix.h [ELF][ARM] Implement --fix-cortex-a8 to fix erratum 657417 2019-09-16 09:38:38 +00:00
CMakeLists.txt [CMake] Make `intrinsics_gen` dependency unconditional. 2020-07-17 16:43:17 -07:00
CallGraphSort.cpp [COFF] Port CallGraphSort to COFF from ELF 2020-07-30 15:21:44 -07:00
CallGraphSort.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Config.h [ELF] Add --dependency-file option 2020-08-03 16:59:13 -07:00
DWARF.cpp [ELF] Use namespace qualifiers (lld:: or elf::) instead of `namespace lld { namespace elf {` 2020-05-15 08:49:53 -07:00
DWARF.h [DebugInfo] Do not hang when parsing a malformed .debug_pub* section. 2020-07-09 19:15:11 +07:00
Driver.cpp [ELF] Add --dependency-file option 2020-08-03 16:59:13 -07:00
Driver.h [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
DriverUtils.cpp [ELF] Use namespace qualifiers (lld:: or elf::) instead of `namespace lld { namespace elf {` 2020-05-15 08:49:53 -07:00
EhFrame.cpp [ELF] --icf: don't fold text sections with LSDA 2020-08-05 09:16:28 -07:00
EhFrame.h [ELF] --icf: don't fold text sections with LSDA 2020-08-05 09:16:28 -07:00
ICF.cpp [ELF] --icf: don't fold text sections with LSDA 2020-08-05 09:16:28 -07:00
ICF.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
InputFiles.cpp [ELF] Allow SHF_LINK_ORDER sections to have sh_link=0 2020-08-05 16:17:42 -07:00
InputFiles.h [ELF] Demote lazy symbols relative to a discarded section to Undefined 2020-06-09 11:27:34 -07:00
InputSection.cpp [ELF] Allow SHF_LINK_ORDER sections to have sh_link=0 2020-08-05 16:17:42 -07:00
InputSection.h [ELF] --icf: don't fold text sections with LSDA 2020-08-05 09:16:28 -07:00
LTO.cpp Rename basic block sections options to be consistent. 2020-07-31 11:50:55 -07:00
LTO.h [Coding style change] Rename variables so that they start with a lowercase letter 2019-07-10 05:00:37 +00:00
LinkerScript.cpp [ELF] Allow sections after a non-SHF_ALLOC section to be covered by PT_LOAD 2020-08-05 09:30:23 -07:00
LinkerScript.h [ELF][ARM] Support /DISCARD/ of subset of .ARM.exidx sections 2020-05-11 14:27:13 +01:00
MapFile.cpp [ELF] Use namespace qualifiers (lld:: or elf::) instead of `namespace lld { namespace elf {` 2020-05-15 08:49:53 -07:00
MapFile.h [ELF] Add --print-archive-stats= 2020-04-29 18:04:37 -07:00
MarkLive.cpp [ELF] Use namespace qualifiers (lld:: or elf::) instead of `namespace lld { namespace elf {` 2020-05-15 08:49:53 -07:00
MarkLive.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Options.td [ELF] Add --dependency-file option 2020-08-03 16:59:13 -07:00
OutputSections.cpp [ELF] -r: rewrite SHT_GROUP content if some members are combined or discarded 2020-07-21 08:49:45 -07:00
OutputSections.h [ELF] Refactor uses of getInputSections to improve efficiency NFC 2020-01-21 12:27:52 +00:00
README.md
Relocations.cpp [ELF] Rename canRelax to toExecRelax. NFC 2020-07-08 10:27:31 -07:00
Relocations.h LLD Support for Basic Block Sections 2020-04-07 06:55:57 -07:00
ScriptLexer.cpp [LLD][ELF] - Linkerscript: report location for the "unclosed comment in a linker script" error. 2020-07-24 11:38:26 +03:00
ScriptLexer.h [LLD][ELF] - Linkerscript: report location for the "unclosed comment in a linker script" error. 2020-07-24 11:38:26 +03:00
ScriptParser.cpp [lld][linkerscript] Fix handling of DEFINED. 2020-07-28 21:18:01 +01:00
ScriptParser.h [ELF] Improve --export-dynamic-symbol performance by checking whether wildcard is really used 2020-06-17 17:12:10 -07:00
SymbolTable.cpp [ELF] Drop an unneeded reference to `symtab` from SymbolTable::addSymbol 2020-07-06 12:05:54 -07:00
SymbolTable.h [ELF] Replace SymbolTable::forEachSymbol with iterator_range symbols() 2019-11-26 09:09:32 -08:00
Symbols.cpp [ELF] Refine --export-dynamic-symbol semantics to be compatible GNU ld 2.35 2020-06-01 11:30:03 -07:00
Symbols.h [LLD][ELF] Implement --discard-* for cases when -r or --emit-relocs are used. 2020-04-25 18:59:41 +07:00
SyntheticSections.cpp [ELF] --icf: don't fold text sections with LSDA 2020-08-05 09:16:28 -07:00
SyntheticSections.h [ELF] --icf: don't fold text sections with LSDA 2020-08-05 09:16:28 -07:00
Target.cpp [ELF] Use namespace qualifiers (lld:: or elf::) instead of `namespace lld { namespace elf {` 2020-05-15 08:49:53 -07:00
Target.h [PowerPC] Implement R_PPC64_REL24_NOTOC local calls, callee requires a TOC 2020-07-20 17:46:49 +00:00
Thunks.cpp [PowerPC] Support for R_PPC64_REL24_NOTOC calls where the caller has no TOC and the callee is not DSO local 2020-07-29 19:49:28 +00:00
Thunks.h [ELF][PPC32] Implement IPLT code sequence for non-preemptible IFUNC 2019-12-29 22:42:53 -08:00
Writer.cpp [ELF] Allow SHF_LINK_ORDER sections to have sh_link=0 2020-08-05 16:17:42 -07:00
Writer.h Revert "Revert r370635, it caused PR43241." 2019-09-06 15:57:24 +00:00

README.md

See docs/NewLLD.rst