Go to file
Ryan Prichard 1c33d14bcd [ELF] Set Out::TlsPhdr earlier for encoding packed reloc tables
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
2018-09-18 00:24:48 +00:00
clang Thread safety analysis: Run more tests with capability attributes [NFC] 2018-09-17 21:37:22 +00:00
clang-tools-extra [clang-tidy] Fix tests for performance-for-range-copy 2018-09-17 21:28:08 +00:00
compiler-rt build: fix standalone builds for compiler-rt on Darwin 2018-09-17 23:25:36 +00:00
debuginfo-tests Revert "(Retry) Add a basic integration test for C++ smart pointers" 2018-08-20 19:53:33 +00:00
libclc configure: Rework support for gfx9+ devices that were added post LLVM 3.9 2018-09-15 22:02:01 +00:00
libcxx Fix typo 2018-09-17 07:40:42 +00:00
libcxxabi Merge Demangle change in r342330 to libcxxabi. 2018-09-15 18:25:49 +00:00
libunwind [CMake] Don't use -rtlib=compiler-rt with -nodefaultlibs. 2018-09-04 20:57:50 +00:00
lld [ELF] Set Out::TlsPhdr earlier for encoding packed reloc tables 2018-09-18 00:24:48 +00:00
lldb Revert "[DataFormatters] Add formatter for C++17 std::variant" 2018-09-17 23:15:35 +00:00
llgo Update copyright year to 2018. 2018-06-18 12:22:17 +00:00
llvm Revert "[ARM] Cleanup ARM CGP isSupportedValue" 2018-09-18 00:11:55 +00:00
openmp [OPENMP]Increment iterator when the loop is continued. 2018-09-11 17:16:26 +00:00
parallel-libs Update copyright year to 2018. 2018-06-18 12:22:17 +00:00
polly [ScopDetection] Use addUnknown for calls in the AliasSetTracker. 2018-09-11 23:48:14 +00:00
README.md

README.md

Low Level Virtual Machine (LLVM)

This directory and its subdirectories contain source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and runtime environments.