diff options
| author | Michael J. Spencer <bigcheesegs@gmail.com> | 2015-11-11 01:28:23 +0000 |
|---|---|---|
| committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2015-11-11 01:28:23 +0000 |
| commit | dc9c5df5cdf4af06179f77a4b451369fcc82aef8 (patch) | |
| tree | 3fc0951b940cb5825f0c2c9717dc92f5e7ebcf6d | |
| parent | ac2307b9ff9de6607f3a19d25cabbcc56d5480fd (diff) | |
| download | bcm5719-llvm-dc9c5df5cdf4af06179f77a4b451369fcc82aef8.tar.gz bcm5719-llvm-dc9c5df5cdf4af06179f77a4b451369fcc82aef8.zip | |
[elf2] Add support for local TLS symbols.
llvm-svn: 252686
| -rw-r--r-- | lld/ELF/OutputSections.cpp | 7 | ||||
| -rw-r--r-- | lld/test/elf2/tls-dynamic.s | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index c6b74fffc46..ce7a3fc2067 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -719,11 +719,16 @@ lld::elf2::getLocalRelTarget(const ObjectFile<ELFT> &File, if (!Sym) error("Unsupported relocation without symbol"); + InputSectionBase<ELFT> *Section = File.getSection(*Sym); + + if (Sym->getType() == STT_TLS) + return (Section->OutSec->getVA() + Section->getOffset(*Sym) + Addend) - + Out<ELF64LE>::TlsPhdr->p_vaddr; + // According to the ELF spec reference to a local symbol from outside // the group are not allowed. Unfortunately .eh_frame breaks that rule // and must be treated specially. For now we just replace the symbol with // 0. - InputSectionBase<ELFT> *Section = File.getSection(*Sym); if (Section == &InputSection<ELFT>::Discarded || !Section->isLive()) return Addend; diff --git a/lld/test/elf2/tls-dynamic.s b/lld/test/elf2/tls-dynamic.s index 4c93c9c2f13..36a6129f923 100644 --- a/lld/test/elf2/tls-dynamic.s +++ b/lld/test/elf2/tls-dynamic.s @@ -18,9 +18,7 @@ .align 4 a: .long 0 - - .global b - .hidden b + .section .tbss,"awT",@nobits .align 4 b: |

