diff options
author | Fangrui Song <maskray@google.com> | 2019-05-18 00:43:10 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2019-05-18 00:43:10 +0000 |
commit | 348731aeed4b5974f4ba6f6eebd0d3a19d5632d2 (patch) | |
tree | 2a0f5bd05bc15fbd7e03aebbc4a9758cfe9e09e8 /lld/ELF/InputSection.cpp | |
parent | f9399de525e590501dae59b0f178bbd860a37942 (diff) | |
download | bcm5719-llvm-348731aeed4b5974f4ba6f6eebd0d3a19d5632d2.tar.gz bcm5719-llvm-348731aeed4b5974f4ba6f6eebd0d3a19d5632d2.zip |
[ELF] Fix TP offset of TLS Variant I after D62059
As Ryan Prichard pointed out, after D62059, the TP offset is incorrect.
Add x86-64-tls-le-align.s to check this. Better formulae for both
variants should take p_vaddr%p_align into account (offset%p_align =
p_vaddr%p_align is a basic ELF requirement), but I can't find a way to
test the behavior.
llvm-svn: 361084
Diffstat (limited to 'lld/ELF/InputSection.cpp')
-rw-r--r-- | lld/ELF/InputSection.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 1bf67e2a338..72a2c298d5e 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -598,7 +598,7 @@ static int64_t getTlsTpOffset() { case EM_386: case EM_X86_64: // Variant 2. The TLS segment is located just before the thread pointer. - return -Out::TlsPhdr->p_memsz; + return -alignTo(Out::TlsPhdr->p_memsz, Out::TlsPhdr->p_align); case EM_PPC64: // The thread pointer points to a fixed offset from the start of the // executable's TLS segment. An offset of 0x7000 allows a signed 16-bit |