1c33d14bcd
Summary: For --pack-dyn-relocs=android, finalizeSections calls LinkerScript::assignAddresses and AndroidPackedRelocationSection::updateAllocSize in a loop, where assignAddresses lays out the ELF image, then updateAllocSize determines the size of the Android packed relocation table by encoding it. Encoding the table requires knowing the values of relocation addends. To get the addend of a TLS relocation, updateAllocSize can call getSymVA on a TLS symbol before setPhdrs has initialized Out::TlsPhdr, producing an error: <file> has an STT_TLS symbol but doesn't have an SHF_TLS section Fix the problem by initializing Out::TlsPhdr immediately after the program headers are created. The segment's p_vaddr field isn't initialized until setPhdrs, so use FirstSec->Addr, which is what setPhdrs would use. FirstSec will typically refer to the .tdata or .tbss output section, whose (tentative) address was computed by assignAddresses. Android currently avoids this problem because it uses emutls and doesn't support ELF TLS. This problem doesn't apply to --pack-dyn-relocs=relr because SHR_RELR only handles relative relocations without explicit addends or info. Fixes https://bugs.llvm.org/show_bug.cgi?id=37841. Reviewers: ruiu, pcc, chh, javed.absar, espindola Subscribers: emaste, arichardson, llvm-commits, srhines Differential Revision: https://reviews.llvm.org/D51671 llvm-svn: 342432 |
||
---|---|---|
.. | ||
Arch | ||
AArch64ErrataFix.cpp | ||
AArch64ErrataFix.h | ||
Bits.h | ||
CMakeLists.txt | ||
CallGraphSort.cpp | ||
CallGraphSort.h | ||
Config.h | ||
DWARF.cpp | ||
DWARF.h | ||
Driver.cpp | ||
Driver.h | ||
DriverUtils.cpp | ||
EhFrame.cpp | ||
EhFrame.h | ||
Filesystem.cpp | ||
Filesystem.h | ||
ICF.cpp | ||
ICF.h | ||
InputFiles.cpp | ||
InputFiles.h | ||
InputSection.cpp | ||
InputSection.h | ||
LTO.cpp | ||
LTO.h | ||
LinkerScript.cpp | ||
LinkerScript.h | ||
MapFile.cpp | ||
MapFile.h | ||
MarkLive.cpp | ||
MarkLive.h | ||
Options.td | ||
OutputSections.cpp | ||
OutputSections.h | ||
README.md | ||
Relocations.cpp | ||
Relocations.h | ||
ScriptLexer.cpp | ||
ScriptLexer.h | ||
ScriptParser.cpp | ||
ScriptParser.h | ||
SymbolTable.cpp | ||
SymbolTable.h | ||
Symbols.cpp | ||
Symbols.h | ||
SyntheticSections.cpp | ||
SyntheticSections.h | ||
Target.cpp | ||
Target.h | ||
Thunks.cpp | ||
Thunks.h | ||
Writer.cpp | ||
Writer.h |
README.md
See docs/NewLLD.rst