forked from OSchip/llvm-project
![]() Current approach for initial-exec in ELF/x86_64 is to create a GOT entry and change the relocation to R_X86_64_PC32 to be handled as a GOT offfset. However there are two issues with this approach: 1. the R_X86_64_PC32 is not really required since the GOT relocation will be handle dynamically and 2. the TLS symbols are not being exported externally and then correct realocation are not being applied. This patch fixes the R_X86_64_GOTTPOFF handling by just emitting a R_X86_64_TPOFF64 dynamically one; it also sets R_X86_64_TPOFF64 to be handled by runtime one. For second part, the patches uses a similar strategy used for aarch64, by reimplementing buildDynamicSymbolTable from X86_64ExecutableWriter and adding the TLS symbols in the dynamic symbol table. Some tests had to be adjusted due the now missing R_X86_64_PC32 relocation. With this test the simple testcase: * t1.c: __thread int t0; __thread int t1; __thread int t2; __thread int t3; * t0.c: extern __thread int t0; extern __thread int t1; extern __thread int t2; extern __thread int t3; __thread int t4; __thread int t5; __thread int t6; __thread int t7; int main () { t0 = 1; t1 = 2; t2 = 3; t3 = 4; t4 = 5; t5 = 6; t6 = 7; t7 = 8; printf ("%i %i %i %i\n", t0, t1, t2, t3); printf ("%i %i %i %i\n", t4, t5, t6, t7); return 0; } Shows correct output for x86_64. llvm-svn: 239908 |
||
---|---|---|
.. | ||
COFF | ||
cmake/modules | ||
docs | ||
include/lld | ||
lib | ||
test | ||
tools | ||
unittests | ||
utils | ||
.arcconfig | ||
.clang-format | ||
.gitignore | ||
CMakeLists.txt | ||
LICENSE.TXT | ||
README.md |
README.md
LLVM Linker (lld)
This directory and its subdirectories contain source code for the LLVM Linker, a modular cross platform linker which is built as part of the LLVM compiler infrastructure project.
lld is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt.