diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 90823a8e7552..8a0a5898e03d 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -57,7 +57,7 @@ void InputSection::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 a6122ed2fd17..0f7862a8163d 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -126,7 +126,7 @@ template void RelocationSection::writeTo(uint8_t *Buf) { if (Body) Addend += getSymVA(cast>(*Body)); else - Addend += getLocalRelTarget(File, RI, Type); + Addend += getLocalRelTarget(File, RI); } P->setSymbolAndType(0, Target->getRelativeReloc(), IsMips64EL); } @@ -424,11 +424,10 @@ typename ELFFile::uintX_t lld::elf2::getSymVA(const SymbolBody &S) { template typename ELFFile::uintX_t lld::elf2::getLocalRelTarget(const ObjectFile &File, - const typename ELFFile::Elf_Rel &RI, - uint32_t Type) { + const typename ELFFile::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::Elf_Sym Elf_Sym; @@ -750,19 +749,19 @@ template ELFFile::uintX_t getSymVA(const SymbolBody &); template ELFFile::uintX_t getLocalRelTarget(const ObjectFile &, - const ELFFile::Elf_Rel &, uint32_t); + const ELFFile::Elf_Rel &); template ELFFile::uintX_t getLocalRelTarget(const ObjectFile &, - const ELFFile::Elf_Rel &, uint32_t); + const ELFFile::Elf_Rel &); template ELFFile::uintX_t getLocalRelTarget(const ObjectFile &, - const ELFFile::Elf_Rel &, uint32_t); + const ELFFile::Elf_Rel &); template ELFFile::uintX_t getLocalRelTarget(const ObjectFile &, - const ELFFile::Elf_Rel &, uint32_t); + const ELFFile::Elf_Rel &); template bool includeInSymtab(const SymbolBody &); template bool includeInSymtab(const SymbolBody &); diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h index 4c62f70d8633..0892ce818347 100644 --- a/lld/ELF/OutputSections.h +++ b/lld/ELF/OutputSections.h @@ -38,8 +38,7 @@ typename llvm::object::ELFFile::uintX_t getSymVA(const SymbolBody &S); template typename llvm::object::ELFFile::uintX_t getLocalRelTarget(const ObjectFile &File, - const typename llvm::object::ELFFile::Elf_Rel &Sym, - uint32_t Type); + const typename llvm::object::ELFFile::Elf_Rel &Sym); bool canBePreempted(const SymbolBody *Body, bool NeedsGot); template bool includeInSymtab(const SymbolBody &B);