diff options
author | Rui Ueyama <ruiu@google.com> | 2016-01-26 01:03:21 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2016-01-26 01:03:21 +0000 |
commit | 1546fb2d656bcfa2cb271a275703637fa4ae2942 (patch) | |
tree | 66248870dfa030592e05f48103b6c788683555e7 | |
parent | 00b87282cd645564ee40bc56616925cb4318dc03 (diff) | |
download | bcm5719-llvm-1546fb2d656bcfa2cb271a275703637fa4ae2942.tar.gz bcm5719-llvm-1546fb2d656bcfa2cb271a275703637fa4ae2942.zip |
Move code to create RELATIVE reloc for TLS_IE to one place.
llvm-svn: 258760
-rw-r--r-- | lld/ELF/OutputSections.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 979728e05a3..619a05f1170 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -289,6 +289,14 @@ template <class ELFT> void RelocationSection<ELFT>::writeTo(uint8_t *Buf) { if (applyTlsDynamicReloc(Body, Type, P, reinterpret_cast<Elf_Rel *>(Buf))) continue; + // Writer::scanRelocs creates a RELATIVE reloc for some type of TLS reloc. + // We want to write it down as is. + if (Type == Target->getRelativeReloc()) { + P->setSymbolAndType(0, Type, Config->Mips64EL); + P->r_offset = C.getOffset(RI.r_offset) + C.OutSec->getVA(); + continue; + } + // Emit a copy relocation. auto *SS = dyn_cast_or_null<SharedSymbol<ELFT>>(Body); if (SS && SS->NeedsCopy) { @@ -316,11 +324,10 @@ template <class ELFT> void RelocationSection<ELFT>::writeTo(uint8_t *Buf) { bool LazyReloc = Body && Target->supportsLazyRelocations() && Target->relocNeedsPlt(Type, *Body); - bool IsDynRelative = Type == Target->getRelativeReloc(); unsigned Sym = CBP ? Body->DynamicSymbolTableIndex : 0; unsigned Reloc; - if (!CBP || IsDynRelative) + if (!CBP) Reloc = Target->getRelativeReloc(); else if (LazyReloc) Reloc = Target->getPltReloc(); @@ -342,7 +349,7 @@ template <class ELFT> void RelocationSection<ELFT>::writeTo(uint8_t *Buf) { OrigAddend = static_cast<const Elf_Rela &>(RI).r_addend; uintX_t Addend; - if (CBP || IsDynRelative) + if (CBP) Addend = OrigAddend; else if (Body) Addend = getSymVA<ELFT>(*Body) + OrigAddend; |