Index: lld/trunk/ELF/InputSection.cpp =================================================================== --- lld/trunk/ELF/InputSection.cpp +++ lld/trunk/ELF/InputSection.cpp @@ -152,8 +152,8 @@ Type = Target->getPltRefReloc(Type); } else if (Target->relocNeedsGot(Type, Body)) { SymVA = Out::Got->getEntryAddr(Body); - Type = Body.isTLS() ? Target->getTlsGotReloc() - : Target->getGotRefReloc(Type); + if (Body.isTLS()) + Type = Target->getTlsGotReloc(); } else if (!Target->relocNeedsCopy(Type, Body) && isa>(Body)) { continue; Index: lld/trunk/ELF/Target.h =================================================================== --- lld/trunk/ELF/Target.h +++ lld/trunk/ELF/Target.h @@ -43,7 +43,6 @@ unsigned getGotPltHeaderEntriesNum() const { return GotPltHeaderEntriesNum; } virtual unsigned getDynReloc(unsigned Type) const { return Type; } virtual bool isTlsDynReloc(unsigned Type) const { return false; } - virtual unsigned getGotRefReloc(unsigned Type) const; virtual unsigned getPltRefReloc(unsigned Type) const; virtual void writeGotHeaderEntries(uint8_t *Buf) const; virtual void writeGotPltHeaderEntries(uint8_t *Buf) const; @@ -78,7 +77,6 @@ unsigned CopyReloc; unsigned PCRelReloc; - unsigned GotRefReloc; unsigned GotReloc; unsigned PltReloc; unsigned RelativeReloc; Index: lld/trunk/ELF/Target.cpp =================================================================== --- lld/trunk/ELF/Target.cpp +++ lld/trunk/ELF/Target.cpp @@ -140,7 +140,6 @@ class AArch64TargetInfo final : public TargetInfo { public: AArch64TargetInfo(); - unsigned getGotRefReloc(unsigned Type) const override; unsigned getPltRefReloc(unsigned Type) const override; void writeGotPltEntry(uint8_t *Buf, uint64_t Plt) const override; void writePltZeroEntry(uint8_t *Buf, uint64_t GotEntryAddr, @@ -157,7 +156,6 @@ template class MipsTargetInfo final : public TargetInfo { public: MipsTargetInfo(); - unsigned getGotRefReloc(unsigned Type) const override; void writeGotHeaderEntries(uint8_t *Buf) const override; void writeGotPltEntry(uint8_t *Buf, uint64_t Plt) const override; void writePltZeroEntry(uint8_t *Buf, uint64_t GotEntryAddr, @@ -207,8 +205,6 @@ return false; } -unsigned TargetInfo::getGotRefReloc(unsigned Type) const { return GotRefReloc; } - unsigned TargetInfo::getPltRefReloc(unsigned Type) const { return PCRelReloc; } bool TargetInfo::isRelRelative(uint32_t Type) const { return true; } @@ -227,7 +223,6 @@ CopyReloc = R_386_COPY; PCRelReloc = R_386_PC32; GotReloc = R_386_GLOB_DAT; - GotRefReloc = R_386_GOT32; PltReloc = R_386_JUMP_SLOT; LazyRelocations = true; PltEntrySize = 16; @@ -342,7 +337,6 @@ CopyReloc = R_X86_64_COPY; PCRelReloc = R_X86_64_PC32; GotReloc = R_X86_64_GLOB_DAT; - GotRefReloc = R_X86_64_PC32; PltReloc = R_X86_64_JUMP_SLOT; RelativeReloc = R_X86_64_RELATIVE; TlsGotReloc = R_X86_64_TPOFF64; @@ -642,7 +636,6 @@ PPC64TargetInfo::PPC64TargetInfo() { PCRelReloc = R_PPC64_REL24; GotReloc = R_PPC64_GLOB_DAT; - GotRefReloc = R_PPC64_REL64; RelativeReloc = R_PPC64_RELATIVE; PltEntrySize = 32; @@ -860,8 +853,6 @@ PltZeroEntrySize = 32; } -unsigned AArch64TargetInfo::getGotRefReloc(unsigned Type) const { return Type; } - unsigned AArch64TargetInfo::getPltRefReloc(unsigned Type) const { return Type; } void AArch64TargetInfo::writeGotPltEntry(uint8_t *Buf, uint64_t Plt) const { @@ -1019,16 +1010,10 @@ template MipsTargetInfo::MipsTargetInfo() { PageSize = 65536; - GotRefReloc = R_MIPS_GOT16; GotHeaderEntriesNum = 2; } template -unsigned MipsTargetInfo::getGotRefReloc(unsigned Type) const { - return Type; -} - -template void MipsTargetInfo::writeGotHeaderEntries(uint8_t *Buf) const { typedef typename llvm::object::ELFFile::Elf_Off Elf_Off; auto *P = reinterpret_cast(Buf);