Delete getTlsGotRel.

It was an old hack to avoid duplicating expression computation, but that
is not needed with getExprRel.

llvm-svn: 268515
This commit is contained in:
Rafael Espindola 2016-05-04 15:51:23 +00:00
parent bc0e1d7492
commit 38bd217d0c
3 changed files with 2 additions and 25 deletions

View File

@ -83,7 +83,6 @@ public:
uint64_t getImplicitAddend(const uint8_t *Buf, uint32_t Type) const override;
void writeGotPltHeader(uint8_t *Buf) const override;
uint32_t getDynRel(uint32_t Type) const override;
uint32_t getTlsGotRel(uint32_t Type) const override;
bool isTlsLocalDynamicRel(uint32_t Type) const override;
bool isTlsGlobalDynamicRel(uint32_t Type) const override;
bool isTlsInitialExecRel(uint32_t Type) const override;
@ -104,7 +103,6 @@ public:
X86_64TargetInfo();
RelExpr getRelExpr(uint32_t Type, const SymbolBody &S) const override;
uint32_t getDynRel(uint32_t Type) const override;
uint32_t getTlsGotRel(uint32_t Type) const override;
bool isTlsLocalDynamicRel(uint32_t Type) const override;
bool isTlsGlobalDynamicRel(uint32_t Type) const override;
bool isTlsInitialExecRel(uint32_t Type) const override;
@ -148,7 +146,6 @@ public:
void writePltZero(uint8_t *Buf) const override;
void writePlt(uint8_t *Buf, uint64_t GotEntryAddr, uint64_t PltEntryAddr,
int32_t Index, unsigned RelOff) const override;
uint32_t getTlsGotRel(uint32_t Type) const override;
bool usesOnlyLowPageBits(uint32_t Type) const override;
void relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const override;
void relaxTlsGdToLe(uint8_t *Loc, uint32_t Type, uint64_t Val) const override;
@ -319,12 +316,6 @@ uint32_t X86TargetInfo::getDynRel(uint32_t Type) const {
return Type;
}
uint32_t X86TargetInfo::getTlsGotRel(uint32_t Type) const {
if (Type == R_386_TLS_IE)
return Type;
return R_386_GOT32;
}
bool X86TargetInfo::isTlsGlobalDynamicRel(uint32_t Type) const {
return Type == R_386_TLS_GD;
}
@ -584,13 +575,6 @@ uint32_t X86_64TargetInfo::getDynRel(uint32_t Type) const {
return Type;
}
uint32_t X86_64TargetInfo::getTlsGotRel(uint32_t Type) const {
// No other types of TLS relocations requiring GOT should
// reach here.
assert(Type == R_X86_64_GOTTPOFF);
return R_X86_64_PC32;
}
bool X86_64TargetInfo::isTlsInitialExecRel(uint32_t Type) const {
return Type == R_X86_64_GOTTPOFF;
}
@ -727,6 +711,7 @@ void X86_64TargetInfo::relocateOne(uint8_t *Loc, uint32_t Type,
case R_X86_64_GOTPCRELX:
case R_X86_64_REX_GOTPCRELX:
case R_X86_64_PC32:
case R_X86_64_GOTTPOFF:
case R_X86_64_PLT32:
case R_X86_64_TLSGD:
case R_X86_64_TLSLD:
@ -1063,12 +1048,6 @@ void AArch64TargetInfo::writePlt(uint8_t *Buf, uint64_t GotEntryAddr,
relocateOne(Buf + 8, R_AARCH64_ADD_ABS_LO12_NC, GotEntryAddr);
}
uint32_t AArch64TargetInfo::getTlsGotRel(uint32_t Type) const {
assert(Type == R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 ||
Type == R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC);
return Type;
}
static void updateAArch64Addr(uint8_t *L, uint64_t Imm) {
uint32_t ImmLo = (Imm & 0x3) << 29;
uint32_t ImmHi = ((Imm & 0x1FFFFC) >> 2) << 5;

View File

@ -28,7 +28,6 @@ public:
virtual bool isTlsLocalDynamicRel(uint32_t Type) const;
virtual bool isTlsGlobalDynamicRel(uint32_t Type) const;
virtual uint32_t getDynRel(uint32_t Type) const { return Type; }
virtual uint32_t getTlsGotRel(uint32_t Type) const { return TlsGotRel; }
virtual void writeGotPltHeader(uint8_t *Buf) const {}
virtual void writeGotPlt(uint8_t *Buf, uint64_t Plt) const {};
virtual uint64_t getImplicitAddend(const uint8_t *Buf, uint32_t Type) const;

View File

@ -672,10 +672,9 @@ void Writer<ELFT>::scanRelocs(InputSectionBase<ELFT> &C, ArrayRef<RelTy> Rels) {
// If a relocation needs GOT, we create a GOT slot for the symbol.
if (refersToGotEntry(Expr)) {
uint32_t T = Body.isTls() ? Target->getTlsGotRel(Type) : Type;
if (Config->EMachine == EM_MIPS && Expr == R_GOT_OFF)
Addend -= MipsGPOffset;
C.Relocations.push_back({Expr, T, Offset, Addend, &Body});
C.Relocations.push_back({Expr, Type, Offset, Addend, &Body});
if (Body.isInGot())
continue;
Out<ELFT>::Got->addEntry(Body);