[lld] r254429 - [ELF] - Target interface simplification, getGotRefReloc() removed.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 1 09:52:40 PST 2015
Author: grimar
Date: Tue Dec 1 11:52:40 2015
New Revision: 254429
URL: http://llvm.org/viewvc/llvm-project?rev=254429&view=rev
Log:
[ELF] - Target interface simplification, getGotRefReloc() removed.
Removes Target::getGotRefReloc() method to simplify Target class a little.
Differential revision: http://reviews.llvm.org/D15107
Modified:
lld/trunk/ELF/InputSection.cpp
lld/trunk/ELF/Target.cpp
lld/trunk/ELF/Target.h
Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=254429&r1=254428&r2=254429&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Tue Dec 1 11:52:40 2015
@@ -152,8 +152,8 @@ void InputSectionBase<ELFT>::relocate(
Type = Target->getPltRefReloc(Type);
} else if (Target->relocNeedsGot(Type, Body)) {
SymVA = Out<ELFT>::Got->getEntryAddr(Body);
- Type = Body.isTLS() ? Target->getTlsGotReloc()
- : Target->getGotRefReloc(Type);
+ if (Body.isTLS())
+ Type = Target->getTlsGotReloc();
} else if (!Target->relocNeedsCopy(Type, Body) &&
isa<SharedSymbol<ELFT>>(Body)) {
continue;
Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=254429&r1=254428&r2=254429&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Tue Dec 1 11:52:40 2015
@@ -140,7 +140,6 @@ public:
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 @@ public:
template <class ELFT> 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 @@ bool TargetInfo::relocNeedsCopy(uint32_t
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 @@ X86TargetInfo::X86TargetInfo() {
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 @@ X86_64TargetInfo::X86_64TargetInfo() {
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 @@ static uint16_t applyPPCHighesta(uint64_
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 @@ AArch64TargetInfo::AArch64TargetInfo() {
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 @@ void AArch64TargetInfo::relocateOne(uint
template <class ELFT> MipsTargetInfo<ELFT>::MipsTargetInfo() {
PageSize = 65536;
- GotRefReloc = R_MIPS_GOT16;
GotHeaderEntriesNum = 2;
}
template <class ELFT>
-unsigned MipsTargetInfo<ELFT>::getGotRefReloc(unsigned Type) const {
- return Type;
-}
-
-template <class ELFT>
void MipsTargetInfo<ELFT>::writeGotHeaderEntries(uint8_t *Buf) const {
typedef typename llvm::object::ELFFile<ELFT>::Elf_Off Elf_Off;
auto *P = reinterpret_cast<Elf_Off *>(Buf);
Modified: lld/trunk/ELF/Target.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.h?rev=254429&r1=254428&r2=254429&view=diff
==============================================================================
--- lld/trunk/ELF/Target.h (original)
+++ lld/trunk/ELF/Target.h Tue Dec 1 11:52:40 2015
@@ -43,7 +43,6 @@ public:
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 @@ protected:
unsigned CopyReloc;
unsigned PCRelReloc;
- unsigned GotRefReloc;
unsigned GotReloc;
unsigned PltReloc;
unsigned RelativeReloc;
More information about the llvm-commits
mailing list