[lld] r259147 - ELF: Make Target's member function names shorter.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 28 18:33:45 PST 2016
Author: ruiu
Date: Thu Jan 28 20:33:45 2016
New Revision: 259147
URL: http://llvm.org/viewvc/llvm-project?rev=259147&view=rev
Log:
ELF: Make Target's member function names shorter.
Modified:
lld/trunk/ELF/InputSection.cpp
lld/trunk/ELF/OutputSections.cpp
lld/trunk/ELF/Target.cpp
lld/trunk/ELF/Target.h
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=259147&r1=259146&r2=259147&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Thu Jan 28 20:33:45 2016
@@ -155,7 +155,7 @@ void InputSectionBase<ELFT>::relocate(ui
uintX_t AddrLoc = OutSec->getVA() + Offset;
auto NextRelocs = llvm::make_range(&RI, Rels.end());
- if (Target->isTlsLocalDynamicReloc(Type) &&
+ if (Target->isTlsLocalDynamicRel(Type) &&
!Target->canRelaxTls(Type, nullptr)) {
Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc,
Out<ELFT>::Got->getLocalTlsIndexVA() +
@@ -172,15 +172,14 @@ void InputSectionBase<ELFT>::relocate(ui
uintX_t SymVA;
if (!Body)
SymVA = getLocalRelTarget(*File, RI, 0);
- else if (Target->relocNeedsGot(Type, *Body))
+ else if (Target->needsGot(Type, *Body))
SymVA = Out<ELFT>::Got->getEntryAddr(*Body);
else
SymVA = getSymVA<ELFT>(*Body);
// By optimizing TLS relocations, it is sometimes needed to skip
// relocations that immediately follow TLS relocations. This function
// knows how many slots we need to skip.
- I += Target->relocateTlsOptimize(BufLoc, BufEnd, Type, AddrLoc, SymVA,
- Body);
+ I += Target->relaxTls(BufLoc, BufEnd, Type, AddrLoc, SymVA, Body);
continue;
}
@@ -206,7 +205,7 @@ void InputSectionBase<ELFT>::relocate(ui
continue;
}
- if (Target->isTlsGlobalDynamicReloc(Type) &&
+ if (Target->isTlsGlobalDynamicRel(Type) &&
!Target->canRelaxTls(Type, Body)) {
Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc,
Out<ELFT>::Got->getGlobalDynAddr(*Body) +
@@ -215,9 +214,9 @@ void InputSectionBase<ELFT>::relocate(ui
}
uintX_t SymVA = getSymVA<ELFT>(*Body);
- if (Target->relocNeedsPlt(Type, *Body)) {
+ if (Target->needsPlt(Type, *Body)) {
SymVA = Out<ELFT>::Plt->getEntryAddr(*Body);
- } else if (Target->relocNeedsGot(Type, *Body)) {
+ } else if (Target->needsGot(Type, *Body)) {
if (Config->EMachine == EM_MIPS && needsMipsLocalGot(Type, Body))
// Under some conditions relocations against non-local symbols require
// entries in the local part of MIPS GOT. In that case we need an entry
@@ -230,9 +229,9 @@ void InputSectionBase<ELFT>::relocate(ui
} else if (!Target->needsCopyRel(Type, *Body) &&
isa<SharedSymbol<ELFT>>(*Body)) {
continue;
- } else if (Target->isTlsDynReloc(Type, *Body)) {
+ } else if (Target->isTlsDynRel(Type, *Body)) {
continue;
- } else if (Target->isSizeReloc(Type) && canBePreempted(Body, false)) {
+ } else if (Target->isSizeRel(Type) && canBePreempted(Body, false)) {
// A SIZE relocation is supposed to set a symbol size, but if a symbol
// can be preempted, the size at runtime may be different than link time.
// If that's the case, we leave the field alone rather than filling it
Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=259147&r1=259146&r2=259147&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Thu Jan 28 20:33:45 2016
@@ -59,10 +59,10 @@ template <class ELFT> void GotPltSection
}
template <class ELFT> void GotPltSection<ELFT>::writeTo(uint8_t *Buf) {
- Target->writeGotPltHeaderEntries(Buf);
+ Target->writeGotPltHeader(Buf);
Buf += Target->GotPltHeaderEntriesNum * sizeof(uintX_t);
for (const SymbolBody *B : Entries) {
- Target->writeGotPltEntry(Buf, Out<ELFT>::Plt->getEntryAddr(*B));
+ Target->writeGotPlt(Buf, Out<ELFT>::Plt->getEntryAddr(*B));
Buf += sizeof(uintX_t);
}
}
@@ -157,7 +157,7 @@ template <class ELFT> void GotSection<EL
}
template <class ELFT> void GotSection<ELFT>::writeTo(uint8_t *Buf) {
- Target->writeGotHeaderEntries(Buf);
+ Target->writeGotHeader(Buf);
for (const auto &L : MipsLocalGotPos) {
uint8_t *Entry = Buf + L.second * sizeof(uintX_t);
write<uintX_t, ELFT::TargetEndianness, sizeof(uintX_t)>(Entry, L.first);
@@ -192,7 +192,7 @@ template <class ELFT> void PltSection<EL
bool LazyReloc = Target->UseLazyBinding;
if (LazyReloc) {
// First write PLT[0] entry which is special.
- Target->writePltZeroEntry(Buf, Out<ELFT>::GotPlt->getVA(), this->getVA());
+ Target->writePltZero(Buf, Out<ELFT>::GotPlt->getVA(), this->getVA());
Off += Target->PltZeroEntrySize;
}
for (auto &I : Entries) {
@@ -203,7 +203,7 @@ template <class ELFT> void PltSection<EL
uint64_t GotE = LazyReloc ? Out<ELFT>::GotPlt->getEntryAddr(*E)
: Out<ELFT>::Got->getEntryAddr(*E);
uint64_t Plt = this->getVA() + Off;
- Target->writePltEntry(Buf + Off, GotVA, GotE, Plt, E->PltIndex, RelOff);
+ Target->writePlt(Buf + Off, GotVA, GotE, Plt, E->PltIndex, RelOff);
Off += Target->PltEntrySize;
}
}
@@ -242,13 +242,13 @@ template <class ELFT>
bool RelocationSection<ELFT>::applyTlsDynamicReloc(SymbolBody *Body,
uint32_t Type, Elf_Rel *P,
Elf_Rel *N) {
- if (Target->isTlsLocalDynamicReloc(Type)) {
+ if (Target->isTlsLocalDynamicRel(Type)) {
P->setSymbolAndType(0, Target->TlsModuleIndexRel, Config->Mips64EL);
P->r_offset = Out<ELFT>::Got->getLocalTlsIndexVA();
return true;
}
- if (!Body || !Target->isTlsGlobalDynamicReloc(Type))
+ if (!Body || !Target->isTlsGlobalDynamicRel(Type))
return false;
if (Target->canRelaxTls(Type, Body)) {
@@ -305,7 +305,7 @@ template <class ELFT> void RelocationSec
continue;
}
- bool NeedsGot = Body && Target->relocNeedsGot(Type, *Body);
+ bool NeedsGot = Body && Target->needsGot(Type, *Body);
bool CBP = canBePreempted(Body, NeedsGot);
// For a symbol with STT_GNU_IFUNC type, we always create a PLT and
@@ -322,7 +322,7 @@ template <class ELFT> void RelocationSec
}
bool LazyReloc =
- Body && Target->UseLazyBinding && Target->relocNeedsPlt(Type, *Body);
+ Body && Target->UseLazyBinding && Target->needsPlt(Type, *Body);
unsigned Reloc;
if (!CBP)
@@ -332,7 +332,7 @@ template <class ELFT> void RelocationSec
else if (NeedsGot)
Reloc = Body->isTls() ? Target->getTlsGotRel() : Target->GotRel;
else
- Reloc = Target->getDynReloc(Type);
+ Reloc = Target->getDynRel(Type);
P->setSymbolAndType(CBP ? Body->DynsymIndex : 0, Reloc, Config->Mips64EL);
if (LazyReloc)
Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=259147&r1=259146&r2=259147&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Thu Jan 28 20:33:45 2016
@@ -85,27 +85,26 @@ namespace {
class X86TargetInfo final : public TargetInfo {
public:
X86TargetInfo();
- void writeGotPltHeaderEntries(uint8_t *Buf) const override;
- unsigned getDynReloc(unsigned Type) const override;
+ void writeGotPltHeader(uint8_t *Buf) const override;
+ unsigned getDynRel(unsigned Type) const override;
unsigned getTlsGotRel(unsigned Type) const override;
- bool isTlsDynReloc(unsigned Type, const SymbolBody &S) const override;
- void writeGotPltEntry(uint8_t *Buf, uint64_t Plt) const override;
- void writePltZeroEntry(uint8_t *Buf, uint64_t GotEntryAddr,
- uint64_t PltEntryAddr) const override;
- void writePltEntry(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
- uint64_t PltEntryAddr, int32_t Index,
- unsigned RelOff) const override;
+ bool isTlsDynRel(unsigned Type, const SymbolBody &S) const override;
+ void writeGotPlt(uint8_t *Buf, uint64_t Plt) const override;
+ void writePltZero(uint8_t *Buf, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr) const override;
+ void writePlt(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr, int32_t Index,
+ unsigned RelOff) const override;
bool needsCopyRel(uint32_t Type, const SymbolBody &S) const override;
- bool relocNeedsDynRelative(unsigned Type) const override;
- bool relocNeedsGot(uint32_t Type, const SymbolBody &S) const override;
- bool relocNeedsPlt(uint32_t Type, const SymbolBody &S) const override;
+ bool needsDynRelative(unsigned Type) const override;
+ bool needsGot(uint32_t Type, const SymbolBody &S) const override;
+ bool needsPlt(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, uint64_t ZA = 0,
uint8_t *PairedLoc = nullptr) const override;
bool canRelaxTls(unsigned Type, const SymbolBody *S) const override;
- unsigned relocateTlsOptimize(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,
- uint64_t P, uint64_t SA,
- const SymbolBody *S) const override;
+ unsigned relaxTls(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type, uint64_t P,
+ uint64_t SA, const SymbolBody *S) const override;
bool isGotRelative(uint32_t Type) const override;
private:
@@ -122,26 +121,25 @@ private:
class X86_64TargetInfo final : public TargetInfo {
public:
X86_64TargetInfo();
- bool isTlsDynReloc(unsigned Type, const SymbolBody &S) const override;
- void writeGotPltHeaderEntries(uint8_t *Buf) const override;
- void writeGotPltEntry(uint8_t *Buf, uint64_t Plt) const override;
- void writePltZeroEntry(uint8_t *Buf, uint64_t GotEntryAddr,
- uint64_t PltEntryAddr) const override;
- void writePltEntry(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
- uint64_t PltEntryAddr, int32_t Index,
- unsigned RelOff) const override;
+ bool isTlsDynRel(unsigned Type, const SymbolBody &S) const override;
+ void writeGotPltHeader(uint8_t *Buf) const override;
+ void writeGotPlt(uint8_t *Buf, uint64_t Plt) const override;
+ void writePltZero(uint8_t *Buf, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr) const override;
+ void writePlt(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr, int32_t Index,
+ unsigned RelOff) const override;
bool needsCopyRel(uint32_t Type, const SymbolBody &S) const override;
- bool relocNeedsGot(uint32_t Type, const SymbolBody &S) const override;
- bool relocNeedsPlt(uint32_t Type, const SymbolBody &S) const override;
+ bool needsGot(uint32_t Type, const SymbolBody &S) const override;
+ bool needsPlt(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, uint64_t ZA = 0,
uint8_t *PairedLoc = nullptr) const override;
bool isRelRelative(uint32_t Type) const override;
bool canRelaxTls(unsigned Type, const SymbolBody *S) const override;
- bool isSizeReloc(uint32_t Type) const override;
- unsigned relocateTlsOptimize(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,
- uint64_t P, uint64_t SA,
- const SymbolBody *S) const override;
+ bool isSizeRel(uint32_t Type) const override;
+ unsigned relaxTls(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type, uint64_t P,
+ uint64_t SA, const SymbolBody *S) const override;
private:
void relocateTlsLdToLe(uint8_t *Loc, uint8_t *BufEnd, uint64_t P,
@@ -157,14 +155,14 @@ private:
class PPCTargetInfo final : public TargetInfo {
public:
PPCTargetInfo();
- void writeGotPltEntry(uint8_t *Buf, uint64_t Plt) const override;
- void writePltZeroEntry(uint8_t *Buf, uint64_t GotEntryAddr,
- uint64_t PltEntryAddr) const override;
- void writePltEntry(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
- uint64_t PltEntryAddr, int32_t Index,
- unsigned RelOff) const override;
- bool relocNeedsGot(uint32_t Type, const SymbolBody &S) const override;
- bool relocNeedsPlt(uint32_t Type, const SymbolBody &S) const override;
+ void writeGotPlt(uint8_t *Buf, uint64_t Plt) const override;
+ void writePltZero(uint8_t *Buf, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr) const override;
+ void writePlt(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr, int32_t Index,
+ unsigned RelOff) const override;
+ bool needsGot(uint32_t Type, const SymbolBody &S) const override;
+ bool needsPlt(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, uint64_t ZA = 0,
uint8_t *PairedLoc = nullptr) const override;
@@ -174,14 +172,14 @@ public:
class PPC64TargetInfo final : public TargetInfo {
public:
PPC64TargetInfo();
- void writeGotPltEntry(uint8_t *Buf, uint64_t Plt) const override;
- void writePltZeroEntry(uint8_t *Buf, uint64_t GotEntryAddr,
- uint64_t PltEntryAddr) const override;
- void writePltEntry(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
- uint64_t PltEntryAddr, int32_t Index,
- unsigned RelOff) const override;
- bool relocNeedsGot(uint32_t Type, const SymbolBody &S) const override;
- bool relocNeedsPlt(uint32_t Type, const SymbolBody &S) const override;
+ void writeGotPlt(uint8_t *Buf, uint64_t Plt) const override;
+ void writePltZero(uint8_t *Buf, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr) const override;
+ void writePlt(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr, int32_t Index,
+ unsigned RelOff) const override;
+ bool needsGot(uint32_t Type, const SymbolBody &S) const override;
+ bool needsPlt(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, uint64_t ZA = 0,
uint8_t *PairedLoc = nullptr) const override;
@@ -191,18 +189,18 @@ public:
class AArch64TargetInfo final : public TargetInfo {
public:
AArch64TargetInfo();
- unsigned getDynReloc(unsigned Type) const override;
- void writeGotPltEntry(uint8_t *Buf, uint64_t Plt) const override;
- void writePltZeroEntry(uint8_t *Buf, uint64_t GotEntryAddr,
- uint64_t PltEntryAddr) const override;
- void writePltEntry(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
- uint64_t PltEntryAddr, int32_t Index,
- unsigned RelOff) const override;
+ unsigned getDynRel(unsigned Type) const override;
+ void writeGotPlt(uint8_t *Buf, uint64_t Plt) const override;
+ void writePltZero(uint8_t *Buf, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr) const override;
+ void writePlt(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr, int32_t Index,
+ unsigned RelOff) const override;
unsigned getTlsGotRel(unsigned Type = -1) const override;
- bool isTlsDynReloc(unsigned Type, const SymbolBody &S) const override;
+ bool isTlsDynRel(unsigned Type, const SymbolBody &S) const override;
bool needsCopyRel(uint32_t Type, const SymbolBody &S) const override;
- bool relocNeedsGot(uint32_t Type, const SymbolBody &S) const override;
- bool relocNeedsPlt(uint32_t Type, const SymbolBody &S) const override;
+ bool needsGot(uint32_t Type, const SymbolBody &S) const override;
+ bool needsPlt(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, uint64_t ZA = 0,
uint8_t *PairedLoc = nullptr) const override;
@@ -211,14 +209,14 @@ public:
class AMDGPUTargetInfo final : public TargetInfo {
public:
AMDGPUTargetInfo();
- void writeGotPltEntry(uint8_t *Buf, uint64_t Plt) const override;
- void writePltZeroEntry(uint8_t *Buf, uint64_t GotEntryAddr,
- uint64_t PltEntryAddr) const override;
- void writePltEntry(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
- uint64_t PltEntryAddr, int32_t Index,
- unsigned RelOff) const override;
- bool relocNeedsGot(uint32_t Type, const SymbolBody &S) const override;
- bool relocNeedsPlt(uint32_t Type, const SymbolBody &S) const override;
+ void writeGotPlt(uint8_t *Buf, uint64_t Plt) const override;
+ void writePltZero(uint8_t *Buf, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr) const override;
+ void writePlt(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr, int32_t Index,
+ unsigned RelOff) const override;
+ bool needsGot(uint32_t Type, const SymbolBody &S) const override;
+ bool needsPlt(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, uint64_t ZA = 0,
uint8_t *PairedLoc = nullptr) const override;
@@ -227,20 +225,20 @@ public:
template <class ELFT> class MipsTargetInfo final : public TargetInfo {
public:
MipsTargetInfo();
- unsigned getDynReloc(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,
- uint64_t PltEntryAddr) const override;
- void writePltEntry(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
- uint64_t PltEntryAddr, int32_t Index,
- unsigned RelOff) const override;
- bool relocNeedsGot(uint32_t Type, const SymbolBody &S) const override;
- bool relocNeedsPlt(uint32_t Type, const SymbolBody &S) const override;
+ unsigned getDynRel(unsigned Type) const override;
+ void writeGotHeader(uint8_t *Buf) const override;
+ void writeGotPlt(uint8_t *Buf, uint64_t Plt) const override;
+ void writePltZero(uint8_t *Buf, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr) const override;
+ void writePlt(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr, int32_t Index,
+ unsigned RelOff) const override;
+ bool needsGot(uint32_t Type, const SymbolBody &S) const override;
+ bool needsPlt(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, uint64_t ZA = 0,
uint8_t *PairedLoc = nullptr) const override;
- bool isHintReloc(uint32_t Type) const override;
+ bool isHintRel(uint32_t Type) const override;
bool isRelRelative(uint32_t Type) const override;
};
} // anonymous namespace
@@ -286,21 +284,21 @@ bool TargetInfo::needsCopyRel(uint32_t T
bool TargetInfo::isGotRelative(uint32_t Type) const { return false; }
-bool TargetInfo::isHintReloc(uint32_t Type) const { return false; }
+bool TargetInfo::isHintRel(uint32_t Type) const { return false; }
bool TargetInfo::isRelRelative(uint32_t Type) const { return true; }
-bool TargetInfo::isSizeReloc(uint32_t Type) const { return false; }
+bool TargetInfo::isSizeRel(uint32_t Type) const { return false; }
-unsigned TargetInfo::relocateTlsOptimize(uint8_t *Loc, uint8_t *BufEnd,
- uint32_t Type, uint64_t P, uint64_t SA,
- const SymbolBody *S) const {
+unsigned TargetInfo::relaxTls(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,
+ uint64_t P, uint64_t SA,
+ const SymbolBody *S) const {
return 0;
}
-void TargetInfo::writeGotHeaderEntries(uint8_t *Buf) const {}
+void TargetInfo::writeGotHeader(uint8_t *Buf) const {}
-void TargetInfo::writeGotPltHeaderEntries(uint8_t *Buf) const {}
+void TargetInfo::writeGotPltHeader(uint8_t *Buf) const {}
X86TargetInfo::X86TargetInfo() {
CopyRel = R_386_COPY;
@@ -318,16 +316,16 @@ X86TargetInfo::X86TargetInfo() {
PltZeroEntrySize = 16;
}
-void X86TargetInfo::writeGotPltHeaderEntries(uint8_t *Buf) const {
+void X86TargetInfo::writeGotPltHeader(uint8_t *Buf) const {
write32le(Buf, Out<ELF32LE>::Dynamic->getVA());
}
-void X86TargetInfo::writeGotPltEntry(uint8_t *Buf, uint64_t Plt) const {
+void X86TargetInfo::writeGotPlt(uint8_t *Buf, uint64_t Plt) const {
// Skip 6 bytes of "pushl (GOT+4)"
write32le(Buf, Plt + 6);
}
-unsigned X86TargetInfo::getDynReloc(unsigned Type) const {
+unsigned X86TargetInfo::getDynRel(unsigned Type) const {
if (Type == R_386_TLS_LE)
return R_386_TLS_TPOFF;
if (Type == R_386_TLS_LE_32)
@@ -341,7 +339,7 @@ unsigned X86TargetInfo::getTlsGotRel(uns
return TlsGotRel;
}
-bool X86TargetInfo::isTlsDynReloc(unsigned Type, const SymbolBody &S) const {
+bool X86TargetInfo::isTlsDynRel(unsigned Type, const SymbolBody &S) const {
if (Type == R_386_TLS_LE || Type == R_386_TLS_LE_32 ||
Type == R_386_TLS_GOTIE)
return Config->Shared;
@@ -350,8 +348,8 @@ bool X86TargetInfo::isTlsDynReloc(unsign
return Type == R_386_TLS_GD;
}
-void X86TargetInfo::writePltZeroEntry(uint8_t *Buf, uint64_t GotEntryAddr,
- uint64_t PltEntryAddr) const {
+void X86TargetInfo::writePltZero(uint8_t *Buf, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr) const {
// Executable files and shared object files have
// separate procedure linkage tables.
if (Config->Shared) {
@@ -374,9 +372,9 @@ void X86TargetInfo::writePltZeroEntry(ui
write32le(Buf + 8, GotEntryAddr + 8); // GOT+8
}
-void X86TargetInfo::writePltEntry(uint8_t *Buf, uint64_t GotAddr,
- uint64_t GotEntryAddr, uint64_t PltEntryAddr,
- int32_t Index, unsigned RelOff) const {
+void X86TargetInfo::writePlt(uint8_t *Buf, uint64_t GotAddr,
+ uint64_t GotEntryAddr, uint64_t PltEntryAddr,
+ int32_t Index, unsigned RelOff) const {
const uint8_t Inst[] = {
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, // jmp *foo_in_GOT|*foo at GOT(%ebx)
0x68, 0x00, 0x00, 0x00, 0x00, // pushl $reloc_offset
@@ -397,15 +395,15 @@ bool X86TargetInfo::needsCopyRel(uint32_
return false;
}
-bool X86TargetInfo::relocNeedsGot(uint32_t Type, const SymbolBody &S) const {
+bool X86TargetInfo::needsGot(uint32_t Type, const SymbolBody &S) const {
if (S.isTls() && Type == R_386_TLS_GD)
return Target->canRelaxTls(Type, &S) && canBePreempted(&S, true);
if (Type == R_386_TLS_GOTIE || Type == R_386_TLS_IE)
return !canRelaxTls(Type, &S);
- return Type == R_386_GOT32 || relocNeedsPlt(Type, S);
+ return Type == R_386_GOT32 || needsPlt(Type, S);
}
-bool X86TargetInfo::relocNeedsPlt(uint32_t Type, const SymbolBody &S) const {
+bool X86TargetInfo::needsPlt(uint32_t Type, const SymbolBody &S) const {
return isGnuIFunc<ELF32LE>(S) ||
(Type == R_386_PLT32 && canBePreempted(&S, true)) ||
(Type == R_386_PC32 && S.isShared());
@@ -475,14 +473,13 @@ bool X86TargetInfo::canRelaxTls(unsigned
(Type == R_386_TLS_GOTIE && !canBePreempted(S, true));
}
-bool X86TargetInfo::relocNeedsDynRelative(unsigned Type) const {
+bool X86TargetInfo::needsDynRelative(unsigned Type) const {
return Config->Shared && Type == R_386_TLS_IE;
}
-unsigned X86TargetInfo::relocateTlsOptimize(uint8_t *Loc, uint8_t *BufEnd,
- uint32_t Type, uint64_t P,
- uint64_t SA,
- const SymbolBody *S) const {
+unsigned X86TargetInfo::relaxTls(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,
+ uint64_t P, uint64_t SA,
+ const SymbolBody *S) const {
switch (Type) {
case R_386_TLS_GD:
if (canBePreempted(S, true))
@@ -623,17 +620,17 @@ X86_64TargetInfo::X86_64TargetInfo() {
PltZeroEntrySize = 16;
}
-void X86_64TargetInfo::writeGotPltHeaderEntries(uint8_t *Buf) const {
+void X86_64TargetInfo::writeGotPltHeader(uint8_t *Buf) const {
write64le(Buf, Out<ELF64LE>::Dynamic->getVA());
}
-void X86_64TargetInfo::writeGotPltEntry(uint8_t *Buf, uint64_t Plt) const {
+void X86_64TargetInfo::writeGotPlt(uint8_t *Buf, uint64_t Plt) const {
// Skip 6 bytes of "jmpq *got(%rip)"
write32le(Buf, Plt + 6);
}
-void X86_64TargetInfo::writePltZeroEntry(uint8_t *Buf, uint64_t GotEntryAddr,
- uint64_t PltEntryAddr) const {
+void X86_64TargetInfo::writePltZero(uint8_t *Buf, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr) const {
const uint8_t PltData[] = {
0xff, 0x35, 0x00, 0x00, 0x00, 0x00, // pushq GOT+8(%rip)
0xff, 0x25, 0x00, 0x00, 0x00, 0x00, // jmp *GOT+16(%rip)
@@ -644,10 +641,9 @@ void X86_64TargetInfo::writePltZeroEntry
write32le(Buf + 8, GotEntryAddr - PltEntryAddr + 4); // GOT+16
}
-void X86_64TargetInfo::writePltEntry(uint8_t *Buf, uint64_t GotAddr,
- uint64_t GotEntryAddr,
- uint64_t PltEntryAddr, int32_t Index,
- unsigned RelOff) const {
+void X86_64TargetInfo::writePlt(uint8_t *Buf, uint64_t GotAddr,
+ uint64_t GotEntryAddr, uint64_t PltEntryAddr,
+ int32_t Index, unsigned RelOff) const {
const uint8_t Inst[] = {
0xff, 0x25, 0x00, 0x00, 0x00, 0x00, // jmpq *got(%rip)
0x68, 0x00, 0x00, 0x00, 0x00, // pushq <relocation index>
@@ -668,19 +664,19 @@ bool X86_64TargetInfo::needsCopyRel(uint
return false;
}
-bool X86_64TargetInfo::relocNeedsGot(uint32_t Type, const SymbolBody &S) const {
+bool X86_64TargetInfo::needsGot(uint32_t Type, const SymbolBody &S) const {
if (Type == R_X86_64_TLSGD)
return Target->canRelaxTls(Type, &S) && canBePreempted(&S, true);
if (Type == R_X86_64_GOTTPOFF)
return !canRelaxTls(Type, &S);
- return Type == R_X86_64_GOTPCREL || relocNeedsPlt(Type, S);
+ return Type == R_X86_64_GOTPCREL || needsPlt(Type, S);
}
-bool X86_64TargetInfo::isTlsDynReloc(unsigned Type, const SymbolBody &S) const {
+bool X86_64TargetInfo::isTlsDynRel(unsigned Type, const SymbolBody &S) const {
return Type == R_X86_64_GOTTPOFF || Type == R_X86_64_TLSGD;
}
-bool X86_64TargetInfo::relocNeedsPlt(uint32_t Type, const SymbolBody &S) const {
+bool X86_64TargetInfo::needsPlt(uint32_t Type, const SymbolBody &S) const {
if (needsCopyRel(Type, S))
return false;
if (isGnuIFunc<ELF64LE>(S))
@@ -737,7 +733,7 @@ bool X86_64TargetInfo::isRelRelative(uin
}
}
-bool X86_64TargetInfo::isSizeReloc(uint32_t Type) const {
+bool X86_64TargetInfo::isSizeRel(uint32_t Type) const {
return Type == R_X86_64_SIZE32 || Type == R_X86_64_SIZE64;
}
@@ -852,10 +848,9 @@ void X86_64TargetInfo::relocateTlsIeToLe
// relocation target, relocations immediately follow the TLS relocation (which
// would be applied to rewritten instructions) may have to be skipped.
// This function returns a number of relocations that need to be skipped.
-unsigned X86_64TargetInfo::relocateTlsOptimize(uint8_t *Loc, uint8_t *BufEnd,
- uint32_t Type, uint64_t P,
- uint64_t SA,
- const SymbolBody *S) const {
+unsigned X86_64TargetInfo::relaxTls(uint8_t *Loc, uint8_t *BufEnd,
+ uint32_t Type, uint64_t P, uint64_t SA,
+ const SymbolBody *S) const {
switch (Type) {
case R_X86_64_DTPOFF32:
relocateOne(Loc, BufEnd, R_X86_64_TPOFF32, P, SA);
@@ -940,17 +935,16 @@ static uint16_t applyPPCHighest(uint64_t
static uint16_t applyPPCHighesta(uint64_t V) { return (V + 0x8000) >> 48; }
PPCTargetInfo::PPCTargetInfo() {}
-void PPCTargetInfo::writeGotPltEntry(uint8_t *Buf, uint64_t Plt) const {}
-void PPCTargetInfo::writePltZeroEntry(uint8_t *Buf, uint64_t GotEntryAddr,
- uint64_t PltEntryAddr) const {}
-void PPCTargetInfo::writePltEntry(uint8_t *Buf, uint64_t GotAddr,
- uint64_t GotEntryAddr,
- uint64_t PltEntryAddr, int32_t Index,
- unsigned RelOff) const {}
-bool PPCTargetInfo::relocNeedsGot(uint32_t Type, const SymbolBody &S) const {
+void PPCTargetInfo::writeGotPlt(uint8_t *Buf, uint64_t Plt) const {}
+void PPCTargetInfo::writePltZero(uint8_t *Buf, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr) const {}
+void PPCTargetInfo::writePlt(uint8_t *Buf, uint64_t GotAddr,
+ uint64_t GotEntryAddr, uint64_t PltEntryAddr,
+ int32_t Index, unsigned RelOff) const {}
+bool PPCTargetInfo::needsGot(uint32_t Type, const SymbolBody &S) const {
return false;
}
-bool PPCTargetInfo::relocNeedsPlt(uint32_t Type, const SymbolBody &S) const {
+bool PPCTargetInfo::needsPlt(uint32_t Type, const SymbolBody &S) const {
return false;
}
bool PPCTargetInfo::isRelRelative(uint32_t Type) const { return false; }
@@ -1007,13 +1001,12 @@ uint64_t getPPC64TocBase() {
return TocVA + 0x8000;
}
-void PPC64TargetInfo::writeGotPltEntry(uint8_t *Buf, uint64_t Plt) const {}
-void PPC64TargetInfo::writePltZeroEntry(uint8_t *Buf, uint64_t GotEntryAddr,
- uint64_t PltEntryAddr) const {}
-void PPC64TargetInfo::writePltEntry(uint8_t *Buf, uint64_t GotAddr,
- uint64_t GotEntryAddr,
- uint64_t PltEntryAddr, int32_t Index,
- unsigned RelOff) const {
+void PPC64TargetInfo::writeGotPlt(uint8_t *Buf, uint64_t Plt) const {}
+void PPC64TargetInfo::writePltZero(uint8_t *Buf, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr) const {}
+void PPC64TargetInfo::writePlt(uint8_t *Buf, uint64_t GotAddr,
+ uint64_t GotEntryAddr, uint64_t PltEntryAddr,
+ int32_t Index, unsigned RelOff) const {
uint64_t Off = GotEntryAddr - getPPC64TocBase();
// FIXME: What we should do, in theory, is get the offset of the function
@@ -1032,8 +1025,8 @@ void PPC64TargetInfo::writePltEntry(uint
write32be(Buf + 28, 0x4e800420); // bctr
}
-bool PPC64TargetInfo::relocNeedsGot(uint32_t Type, const SymbolBody &S) const {
- if (relocNeedsPlt(Type, S))
+bool PPC64TargetInfo::needsGot(uint32_t Type, const SymbolBody &S) const {
+ if (needsPlt(Type, S))
return true;
switch (Type) {
@@ -1048,7 +1041,7 @@ bool PPC64TargetInfo::relocNeedsGot(uint
}
}
-bool PPC64TargetInfo::relocNeedsPlt(uint32_t Type, const SymbolBody &S) const {
+bool PPC64TargetInfo::needsPlt(uint32_t Type, const SymbolBody &S) const {
// These are function calls that need to be redirected through a PLT stub.
return Type == R_PPC64_REL24 && canBePreempted(&S, false);
}
@@ -1193,7 +1186,7 @@ AArch64TargetInfo::AArch64TargetInfo() {
PltZeroEntrySize = 32;
}
-unsigned AArch64TargetInfo::getDynReloc(unsigned Type) const {
+unsigned AArch64TargetInfo::getDynRel(unsigned Type) const {
if (Type == R_AARCH64_ABS32 || Type == R_AARCH64_ABS64)
return Type;
StringRef S = getELFRelocationTypeName(EM_AARCH64, Type);
@@ -1201,12 +1194,12 @@ unsigned AArch64TargetInfo::getDynReloc(
"recompile with -fPIC.");
}
-void AArch64TargetInfo::writeGotPltEntry(uint8_t *Buf, uint64_t Plt) const {
+void AArch64TargetInfo::writeGotPlt(uint8_t *Buf, uint64_t Plt) const {
write64le(Buf, Out<ELF64LE>::Plt->getVA());
}
-void AArch64TargetInfo::writePltZeroEntry(uint8_t *Buf, uint64_t GotEntryAddr,
- uint64_t PltEntryAddr) const {
+void AArch64TargetInfo::writePltZero(uint8_t *Buf, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr) const {
const uint8_t PltData[] = {
0xf0, 0x7b, 0xbf, 0xa9, // stp x16, x30, [sp,#-16]!
0x10, 0x00, 0x00, 0x90, // adrp x16, Page(&(.plt.got[2]))
@@ -1227,10 +1220,9 @@ void AArch64TargetInfo::writePltZeroEntr
GotEntryAddr + 16);
}
-void AArch64TargetInfo::writePltEntry(uint8_t *Buf, uint64_t GotAddr,
- uint64_t GotEntryAddr,
- uint64_t PltEntryAddr, int32_t Index,
- unsigned RelOff) const {
+void AArch64TargetInfo::writePlt(uint8_t *Buf, uint64_t GotAddr,
+ uint64_t GotEntryAddr, uint64_t PltEntryAddr,
+ int32_t Index, unsigned RelOff) const {
const uint8_t Inst[] = {
0x10, 0x00, 0x00, 0x90, // adrp x16, Page(&(.plt.got[n]))
0x11, 0x02, 0x40, 0xf9, // ldr x17, [x16, Offset(&(.plt.got[n]))]
@@ -1254,8 +1246,7 @@ unsigned AArch64TargetInfo::getTlsGotRel
return TlsGotRel;
}
-bool AArch64TargetInfo::isTlsDynReloc(unsigned Type,
- const SymbolBody &S) const {
+bool AArch64TargetInfo::isTlsDynRel(unsigned Type, const SymbolBody &S) const {
return Type == R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 ||
Type == R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC;
}
@@ -1283,8 +1274,7 @@ bool AArch64TargetInfo::needsCopyRel(uin
}
}
-bool AArch64TargetInfo::relocNeedsGot(uint32_t Type,
- const SymbolBody &S) const {
+bool AArch64TargetInfo::needsGot(uint32_t Type, const SymbolBody &S) const {
switch (Type) {
case R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC:
case R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
@@ -1292,12 +1282,11 @@ bool AArch64TargetInfo::relocNeedsGot(ui
case R_AARCH64_LD64_GOT_LO12_NC:
return true;
default:
- return relocNeedsPlt(Type, S);
+ return needsPlt(Type, S);
}
}
-bool AArch64TargetInfo::relocNeedsPlt(uint32_t Type,
- const SymbolBody &S) const {
+bool AArch64TargetInfo::needsPlt(uint32_t Type, const SymbolBody &S) const {
if (isGnuIFunc<ELF64LE>(S))
return true;
switch (Type) {
@@ -1423,27 +1412,26 @@ void AArch64TargetInfo::relocateOne(uint
AMDGPUTargetInfo::AMDGPUTargetInfo() {}
-void AMDGPUTargetInfo::writeGotPltEntry(uint8_t *Buf, uint64_t Plt) const {
+void AMDGPUTargetInfo::writeGotPlt(uint8_t *Buf, uint64_t Plt) const {
llvm_unreachable("not implemented");
}
-void AMDGPUTargetInfo::writePltZeroEntry(uint8_t *Buf, uint64_t GotEntryAddr,
- uint64_t PltEntryAddr) const {
+void AMDGPUTargetInfo::writePltZero(uint8_t *Buf, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr) const {
llvm_unreachable("not implemented");
}
-void AMDGPUTargetInfo::writePltEntry(uint8_t *Buf, uint64_t GotAddr,
- uint64_t GotEntryAddr,
- uint64_t PltEntryAddr, int32_t Index,
- unsigned RelOff) const {
+void AMDGPUTargetInfo::writePlt(uint8_t *Buf, uint64_t GotAddr,
+ uint64_t GotEntryAddr, uint64_t PltEntryAddr,
+ int32_t Index, unsigned RelOff) const {
llvm_unreachable("not implemented");
}
-bool AMDGPUTargetInfo::relocNeedsGot(uint32_t Type, const SymbolBody &S) const {
+bool AMDGPUTargetInfo::needsGot(uint32_t Type, const SymbolBody &S) const {
return false;
}
-bool AMDGPUTargetInfo::relocNeedsPlt(uint32_t Type, const SymbolBody &S) const {
+bool AMDGPUTargetInfo::needsPlt(uint32_t Type, const SymbolBody &S) const {
return false;
}
@@ -1464,7 +1452,7 @@ template <class ELFT> MipsTargetInfo<ELF
}
template <class ELFT>
-unsigned MipsTargetInfo<ELFT>::getDynReloc(unsigned Type) const {
+unsigned MipsTargetInfo<ELFT>::getDynRel(unsigned Type) const {
if (Type == R_MIPS_32 || Type == R_MIPS_64)
return R_MIPS_REL32;
StringRef S = getELFRelocationTypeName(EM_MIPS, Type);
@@ -1473,7 +1461,7 @@ unsigned MipsTargetInfo<ELFT>::getDynRel
}
template <class ELFT>
-void MipsTargetInfo<ELFT>::writeGotHeaderEntries(uint8_t *Buf) const {
+void MipsTargetInfo<ELFT>::writeGotHeader(uint8_t *Buf) const {
typedef typename ELFFile<ELFT>::Elf_Off Elf_Off;
auto *P = reinterpret_cast<Elf_Off *>(Buf);
// Module pointer
@@ -1481,25 +1469,23 @@ void MipsTargetInfo<ELFT>::writeGotHeade
}
template <class ELFT>
-void MipsTargetInfo<ELFT>::writeGotPltEntry(uint8_t *Buf, uint64_t Plt) const {}
+void MipsTargetInfo<ELFT>::writeGotPlt(uint8_t *Buf, uint64_t Plt) const {}
template <class ELFT>
-void MipsTargetInfo<ELFT>::writePltZeroEntry(uint8_t *Buf, uint64_t GotEntryAddr,
- uint64_t PltEntryAddr) const {}
+void MipsTargetInfo<ELFT>::writePltZero(uint8_t *Buf, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr) const {}
template <class ELFT>
-void MipsTargetInfo<ELFT>::writePltEntry(uint8_t *Buf, uint64_t GotAddr,
- uint64_t GotEntryAddr,
- uint64_t PltEntryAddr, int32_t Index,
- unsigned RelOff) const {}
+void MipsTargetInfo<ELFT>::writePlt(uint8_t *Buf, uint64_t GotAddr,
+ uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr, int32_t Index,
+ unsigned RelOff) const {}
template <class ELFT>
-bool MipsTargetInfo<ELFT>::relocNeedsGot(uint32_t Type,
- const SymbolBody &S) const {
+bool MipsTargetInfo<ELFT>::needsGot(uint32_t Type, const SymbolBody &S) const {
return Type == R_MIPS_GOT16 || Type == R_MIPS_CALL16;
}
template <class ELFT>
-bool MipsTargetInfo<ELFT>::relocNeedsPlt(uint32_t Type,
- const SymbolBody &S) const {
+bool MipsTargetInfo<ELFT>::needsPlt(uint32_t Type, const SymbolBody &S) const {
return false;
}
@@ -1601,7 +1587,7 @@ void MipsTargetInfo<ELFT>::relocateOne(u
}
template <class ELFT>
-bool MipsTargetInfo<ELFT>::isHintReloc(uint32_t Type) const {
+bool MipsTargetInfo<ELFT>::isHintRel(uint32_t Type) const {
return Type == R_MIPS_JALR;
}
Modified: lld/trunk/ELF/Target.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.h?rev=259147&r1=259146&r2=259147&view=diff
==============================================================================
--- lld/trunk/ELF/Target.h (original)
+++ lld/trunk/ELF/Target.h Thu Jan 28 20:33:45 2016
@@ -23,35 +23,35 @@ class TargetInfo {
public:
uint64_t getVAStart() const;
- bool isTlsLocalDynamicReloc(unsigned Type) const {
+ bool isTlsLocalDynamicRel(unsigned Type) const {
return Type == TlsLocalDynamicRel;
}
- bool isTlsGlobalDynamicReloc(unsigned Type) const {
+ bool isTlsGlobalDynamicRel(unsigned Type) const {
return Type == TlsGlobalDynamicRel;
}
- virtual unsigned getDynReloc(unsigned Type) const { return Type; }
+ virtual unsigned getDynRel(unsigned Type) const { return Type; }
- virtual bool isTlsDynReloc(unsigned Type, const SymbolBody &S) const {
+ virtual bool isTlsDynRel(unsigned Type, const SymbolBody &S) const {
return false;
}
virtual unsigned getTlsGotRel(unsigned Type = -1) const { return TlsGotRel; }
- virtual void writeGotHeaderEntries(uint8_t *Buf) const;
- virtual void writeGotPltHeaderEntries(uint8_t *Buf) const;
- virtual void writeGotPltEntry(uint8_t *Buf, uint64_t Plt) const = 0;
- virtual void writePltZeroEntry(uint8_t *Buf, uint64_t GotEntryAddr,
- uint64_t PltEntryAddr) const = 0;
- virtual void writePltEntry(uint8_t *Buf, uint64_t GotAddr,
- uint64_t GotEntryAddr, uint64_t PltEntryAddr,
- int32_t Index, unsigned RelOff) const = 0;
+ virtual void writeGotHeader(uint8_t *Buf) const;
+ virtual void writeGotPltHeader(uint8_t *Buf) const;
+ virtual void writeGotPlt(uint8_t *Buf, uint64_t Plt) const = 0;
+ virtual void writePltZero(uint8_t *Buf, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr) const = 0;
+ virtual void writePlt(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
+ uint64_t PltEntryAddr, int32_t Index,
+ unsigned RelOff) const = 0;
// Returns true if a relocation is just a hint for linker to make for example
// some code optimization. Such relocations should not be handled as a regular
// ones and lead to dynamic relocation creation etc.
- virtual bool isHintReloc(uint32_t Type) const;
+ virtual bool isHintRel(uint32_t Type) const;
// Returns true if a relocation is relative to the place being relocated,
// such as relocations used for PC-relative instructions. Such relocations
@@ -60,19 +60,18 @@ public:
// dynamic linker if isRelRelative returns true.
virtual bool isRelRelative(uint32_t Type) const;
- virtual bool isSizeReloc(uint32_t Type) const;
- virtual bool relocNeedsDynRelative(unsigned Type) const { return false; }
- virtual bool relocNeedsGot(uint32_t Type, const SymbolBody &S) const = 0;
- virtual bool relocNeedsPlt(uint32_t Type, const SymbolBody &S) const = 0;
+ virtual bool isSizeRel(uint32_t Type) const;
+ virtual bool needsDynRelative(unsigned Type) const { return false; }
+ virtual bool needsGot(uint32_t Type, const SymbolBody &S) const = 0;
+ virtual bool needsPlt(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, uint64_t ZA = 0,
uint8_t *PairedLoc = nullptr) const = 0;
virtual bool isGotRelative(uint32_t Type) const;
virtual bool canRelaxTls(unsigned Type, const SymbolBody *S) const;
virtual bool needsCopyRel(uint32_t Type, const SymbolBody &S) const;
- virtual unsigned relocateTlsOptimize(uint8_t *Loc, uint8_t *BufEnd,
- uint32_t Type, uint64_t P, uint64_t SA,
- const SymbolBody *S) const;
+ virtual unsigned relaxTls(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,
+ uint64_t P, uint64_t SA, const SymbolBody *S) const;
virtual ~TargetInfo();
unsigned PageSize = 4096;
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=259147&r1=259146&r2=259147&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Jan 28 20:33:45 2016
@@ -200,7 +200,7 @@ template <bool Is64Bits> struct DenseMap
template <class ELFT, class RelT>
static bool handleTlsRelocation(unsigned Type, SymbolBody *Body,
InputSectionBase<ELFT> &C, RelT &RI) {
- if (Target->isTlsLocalDynamicReloc(Type)) {
+ if (Target->isTlsLocalDynamicRel(Type)) {
if (Target->canRelaxTls(Type, nullptr))
return true;
if (Out<ELFT>::Got->addCurrentModuleTlsIndex())
@@ -211,7 +211,7 @@ static bool handleTlsRelocation(unsigned
if (!Body || !Body->isTls())
return false;
- if (Target->isTlsGlobalDynamicReloc(Type)) {
+ if (Target->isTlsGlobalDynamicRel(Type)) {
bool Opt = Target->canRelaxTls(Type, Body);
if (!Opt && Out<ELFT>::Got->addDynTlsEntry(Body)) {
Out<ELFT>::RelaDyn->addReloc({&C, &RI});
@@ -222,7 +222,7 @@ static bool handleTlsRelocation(unsigned
if (!canBePreempted(Body, true))
return true;
}
- return !Target->isTlsDynReloc(Type, *Body);
+ return !Target->isTlsDynRel(Type, *Body);
}
// The reason we have to do this early scan is as follows
@@ -246,7 +246,7 @@ void Writer<ELFT>::scanRelocs(
uint32_t Type = RI.getType(Config->Mips64EL);
// Ignore "hint" relocation because it is for optional code optimization.
- if (Target->isHintReloc(Type))
+ if (Target->isHintRel(Type))
continue;
if (Target->isGotRelative(Type))
@@ -263,7 +263,7 @@ void Writer<ELFT>::scanRelocs(
if (handleTlsRelocation<ELFT>(Type, Body, C, RI))
continue;
- if (Target->relocNeedsDynRelative(Type)) {
+ if (Target->needsDynRelative(Type)) {
RelType *Rel = new (Alloc) RelType;
Rel->setSymbolAndType(0, Target->RelativeRel, Config->Mips64EL);
Rel->r_offset = RI.r_offset;
@@ -284,13 +284,13 @@ void Writer<ELFT>::scanRelocs(
if (Target->needsCopyRel(Type, *Body))
E->NeedsCopy = true;
}
- NeedsPlt = Target->relocNeedsPlt(Type, *Body);
+ NeedsPlt = Target->needsPlt(Type, *Body);
if (NeedsPlt) {
if (Body->isInPlt())
continue;
Out<ELFT>::Plt->addEntry(Body);
}
- NeedsGot = Target->relocNeedsGot(Type, *Body);
+ NeedsGot = Target->needsGot(Type, *Body);
if (NeedsGot) {
if (NeedsPlt && Target->UseLazyBinding) {
Out<ELFT>::GotPlt->addEntry(Body);
@@ -342,7 +342,7 @@ void Writer<ELFT>::scanRelocs(
// a relocation from an object file, but some relocations need no
// load-time fixup when the final target is known. Skip such relocation.
bool CBP = canBePreempted(Body, NeedsGot);
- bool NoDynrel = Target->isRelRelative(Type) || Target->isSizeReloc(Type) ||
+ bool NoDynrel = Target->isRelRelative(Type) || Target->isSizeRel(Type) ||
!Config->Shared;
if (!CBP && NoDynrel)
continue;
More information about the llvm-commits
mailing list