Index: lld/trunk/ELF/InputSection.cpp =================================================================== --- lld/trunk/ELF/InputSection.cpp +++ lld/trunk/ELF/InputSection.cpp @@ -148,9 +148,6 @@ SymVA = Out::Got->getEntryAddr(Body); Type = Body.isTLS() ? Target->getTlsGotReloc() : Target->getGotRefReloc(Type); - } else if (Target->relocPointsToGot(Type)) { - SymVA = Out::Got->getVA(); - Type = Target->getPCRelReloc(); } 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 @@ -24,7 +24,6 @@ unsigned getPageSize() const { return PageSize; } uint64_t getVAStart() const; unsigned getCopyReloc() const { return CopyReloc; } - unsigned getPCRelReloc() const { return PCRelReloc; } unsigned getGotReloc() const { return GotReloc; } unsigned getPltReloc() const { return PltReloc; } unsigned getRelativeReloc() const { return RelativeReloc; } @@ -55,7 +54,6 @@ virtual bool isRelRelative(uint32_t Type) const; virtual bool relocNeedsCopy(uint32_t Type, const SymbolBody &S) const; virtual bool relocNeedsGot(uint32_t Type, const SymbolBody &S) const = 0; - virtual bool relocPointsToGot(uint32_t Type) const; virtual bool relocNeedsPlt(uint32_t Type, const SymbolBody &S) const = 0; virtual void relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type, uint64_t P, uint64_t SA) const = 0; Index: lld/trunk/ELF/Target.cpp =================================================================== --- lld/trunk/ELF/Target.cpp +++ lld/trunk/ELF/Target.cpp @@ -53,7 +53,6 @@ uint64_t PltEntryAddr, int32_t Index) const override; bool relocNeedsCopy(uint32_t Type, const SymbolBody &S) const override; bool relocNeedsGot(uint32_t Type, const SymbolBody &S) const override; - bool relocPointsToGot(uint32_t Type) const override; bool relocNeedsPlt(uint32_t Type, const SymbolBody &S) const override; void relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type, uint64_t P, uint64_t SA) const override; @@ -166,8 +165,6 @@ unsigned TargetInfo::getPltRefReloc(unsigned Type) const { return PCRelReloc; } -bool TargetInfo::relocPointsToGot(uint32_t Type) const { return false; } - bool TargetInfo::isRelRelative(uint32_t Type) const { return true; } void TargetInfo::relocateTlsOptimize(uint8_t *Loc, uint8_t *BufEnd, uint64_t P, @@ -209,10 +206,6 @@ return Type == R_386_GOT32 || relocNeedsPlt(Type, S); } -bool X86TargetInfo::relocPointsToGot(uint32_t Type) const { - return Type == R_386_GOTPC; -} - bool X86TargetInfo::relocNeedsPlt(uint32_t Type, const SymbolBody &S) const { return Type == R_386_PLT32 || (Type == R_386_PC32 && S.isShared()); } @@ -223,6 +216,9 @@ case R_386_GOT32: add32le(Loc, SA - Out::Got->getVA()); break; + case R_386_GOTPC: + add32le(Loc, SA + Out::Got->getVA() - P); + break; case R_386_PC32: add32le(Loc, SA - P); break;