diff options
-rw-r--r-- | lld/ELF/InputSection.cpp | 2 | ||||
-rw-r--r-- | lld/ELF/OutputSections.cpp | 15 | ||||
-rw-r--r-- | lld/ELF/OutputSections.h | 3 |
3 files changed, 9 insertions, 11 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 90823a8e755..8a0a5898e03 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -57,7 +57,7 @@ void InputSection<ELFT>::relocate( // resolved so we don't allocate a SymbolBody. const Elf_Shdr *SymTab = File.getSymbolTable(); if (SymIndex < SymTab->sh_info) { - uintX_t SymVA = getLocalRelTarget(File, RI, Type); + uintX_t SymVA = getLocalRelTarget(File, RI); relocateOne(Buf, BufEnd, RI, Type, BaseAddr, SymVA); continue; } diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index a6122ed2fd1..0f7862a8163 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -126,7 +126,7 @@ template <class ELFT> void RelocationSection<ELFT>::writeTo(uint8_t *Buf) { if (Body) Addend += getSymVA<ELFT>(cast<ELFSymbolBody<ELFT>>(*Body)); else - Addend += getLocalRelTarget(File, RI, Type); + Addend += getLocalRelTarget(File, RI); } P->setSymbolAndType(0, Target->getRelativeReloc(), IsMips64EL); } @@ -424,11 +424,10 @@ typename ELFFile<ELFT>::uintX_t lld::elf2::getSymVA(const SymbolBody &S) { template <class ELFT> typename ELFFile<ELFT>::uintX_t lld::elf2::getLocalRelTarget(const ObjectFile<ELFT> &File, - const typename ELFFile<ELFT>::Elf_Rel &RI, - uint32_t Type) { + const typename ELFFile<ELFT>::Elf_Rel &RI) { // PPC64 has a special relocation representing the TOC base pointer // that does not have a corresponding symbol. - if (Config->EMachine == EM_PPC64 && Type == R_PPC64_TOC) + if (Config->EMachine == EM_PPC64 && RI.getType(false) == R_PPC64_TOC) return getPPC64TocBase(); typedef typename ELFFile<ELFT>::Elf_Sym Elf_Sym; @@ -750,19 +749,19 @@ template ELFFile<ELF64BE>::uintX_t getSymVA<ELF64BE>(const SymbolBody &); template ELFFile<ELF32LE>::uintX_t getLocalRelTarget(const ObjectFile<ELF32LE> &, - const ELFFile<ELF32LE>::Elf_Rel &, uint32_t); + const ELFFile<ELF32LE>::Elf_Rel &); template ELFFile<ELF32BE>::uintX_t getLocalRelTarget(const ObjectFile<ELF32BE> &, - const ELFFile<ELF32BE>::Elf_Rel &, uint32_t); + const ELFFile<ELF32BE>::Elf_Rel &); template ELFFile<ELF64LE>::uintX_t getLocalRelTarget(const ObjectFile<ELF64LE> &, - const ELFFile<ELF64LE>::Elf_Rel &, uint32_t); + const ELFFile<ELF64LE>::Elf_Rel &); template ELFFile<ELF64BE>::uintX_t getLocalRelTarget(const ObjectFile<ELF64BE> &, - const ELFFile<ELF64BE>::Elf_Rel &, uint32_t); + const ELFFile<ELF64BE>::Elf_Rel &); template bool includeInSymtab<ELF32LE>(const SymbolBody &); template bool includeInSymtab<ELF32BE>(const SymbolBody &); diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h index 4c62f70d863..0892ce81834 100644 --- a/lld/ELF/OutputSections.h +++ b/lld/ELF/OutputSections.h @@ -38,8 +38,7 @@ typename llvm::object::ELFFile<ELFT>::uintX_t getSymVA(const SymbolBody &S); template <class ELFT> typename llvm::object::ELFFile<ELFT>::uintX_t getLocalRelTarget(const ObjectFile<ELFT> &File, - const typename llvm::object::ELFFile<ELFT>::Elf_Rel &Sym, - uint32_t Type); + const typename llvm::object::ELFFile<ELFT>::Elf_Rel &Sym); bool canBePreempted(const SymbolBody *Body, bool NeedsGot); template <class ELFT> bool includeInSymtab(const SymbolBody &B); |