summaryrefslogtreecommitdiffstats
path: root/lld/ELF/OutputSections.cpp
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2015-11-11 01:28:23 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2015-11-11 01:28:23 +0000
commitdc9c5df5cdf4af06179f77a4b451369fcc82aef8 (patch)
tree3fc0951b940cb5825f0c2c9717dc92f5e7ebcf6d /lld/ELF/OutputSections.cpp
parentac2307b9ff9de6607f3a19d25cabbcc56d5480fd (diff)
downloadbcm5719-llvm-dc9c5df5cdf4af06179f77a4b451369fcc82aef8.tar.gz
bcm5719-llvm-dc9c5df5cdf4af06179f77a4b451369fcc82aef8.zip
[elf2] Add support for local TLS symbols.
llvm-svn: 252686
Diffstat (limited to 'lld/ELF/OutputSections.cpp')
-rw-r--r--lld/ELF/OutputSections.cpp7
1 files changed, 6 insertions, 1 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;
OpenPOWER on IntegriCloud