[PATCH] D62059: [ELF] Don't align PT_TLS's p_memsz
Ryan Prichard via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 17 12:55:42 PDT 2019
rprichard added a comment.
I had suggested doing something like this at https://reviews.llvm.org/D53906#1326683. I like the idea, but I think we need to fix up the variant 2 case in 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;
e.g. If the TLS segment is 4-bytes in size with 8-byte alignment (and assuming p_vaddr % p_align == 0), then the segment will be located at TP-8 on variant 2 targets, not TP-4.
I haven't tested this, but something like this would probably work:
return -alignTo(Out::TlsPhdr->p_memsz, Out::TlsPhdr->p_align);
Otherwise, lld and the loader will disagree about the location of TLS symbols.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62059/new/
https://reviews.llvm.org/D62059
More information about the llvm-commits
mailing list