[PATCH] [lld] [ELF] Support for general dynamic TLS relocations on X86_64
Rafael Auler
rafaelauler at gmail.com
Mon Sep 29 12:50:59 PDT 2014
I have a few minor updates to this patch.
1. I enhanced the test case to also check whether the PLT32 relocation against tls_get_addr is being properly generated in a shared lib, if it uses TLS.
2. When I removed the tlsgetaddr atom, the PLT32 relocation against tls_get_addr stopped being generated. I fixed this in a logic in the X86_64RelocationPass.cpp that would only add a PLT relocation if the symbol came from a SharedLib. I changed this to add whenever it comes from a SharedLIb <or> if it is undefined, because we can't leave a PLT32 unresolved if the target is not defined.
3. I removed the logic that checks whether the symbol comes from the dynamic linker and, if so, do not add it to DT_NEEDED. This logic is quite expensive (needs to strcmp every symbol that is being added to the dynamic symbol table) and I am not sure if this is necessary, I only did it to mimic gnu ld.
If you want to accept this patch, could you please commit it? I don't have commit access.
http://reviews.llvm.org/D5505
Files:
include/lld/ReaderWriter/ELFLinkingContext.h
lib/ReaderWriter/ELF/AArch64/AArch64DynamicLibraryWriter.h
lib/ReaderWriter/ELF/AArch64/AArch64ExecutableWriter.h
lib/ReaderWriter/ELF/Atoms.h
lib/ReaderWriter/ELF/DefaultLayout.h
lib/ReaderWriter/ELF/ELFLinkingContext.cpp
lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h
lib/ReaderWriter/ELF/OutputELFWriter.h
lib/ReaderWriter/ELF/TODO.txt
lib/ReaderWriter/ELF/X86_64/X86_64DynamicLibraryWriter.h
lib/ReaderWriter/ELF/X86_64/X86_64ExecutableWriter.h
lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.h
lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.cpp
lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.cpp
test/elf/X86_64/Inputs/generaltls-so.o.yaml
test/elf/X86_64/general-dynamic-tls.test
test/elf/X86_64/omagic.test
test/elf/X86_64/undef.test
test/elf/X86_64/underscore-end.test
test/elf/dynamic-segorder.test
test/elf/dynamic-undef.test
test/elf/undef-from-main-dso.test
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5505.14184.patch
Type: text/x-patch
Size: 27843 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140929/d416e783/attachment.bin>
More information about the llvm-commits
mailing list