[PATCH] D16880: [ELF] - Remove R_X86_64_GOTTPOFF from static relocation proccessing
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 11 03:19:02 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL260508: [ELF] - Remove R_X86_64_GOTTPOFF from static relocation processing (authored by grimar).
Changed prior to commit:
http://reviews.llvm.org/D16880?vs=47304&id=47622#toc
Repository:
rL LLVM
http://reviews.llvm.org/D16880
Files:
lld/trunk/ELF/Target.cpp
lld/trunk/ELF/Target.h
lld/trunk/ELF/Writer.cpp
Index: lld/trunk/ELF/Target.h
===================================================================
--- lld/trunk/ELF/Target.h
+++ lld/trunk/ELF/Target.h
@@ -26,7 +26,7 @@
bool isTlsGlobalDynamicRel(unsigned Type) const;
virtual unsigned getDynRel(unsigned Type) const { return Type; }
virtual bool isTlsDynRel(unsigned Type, const SymbolBody &S) const;
- virtual unsigned getTlsGotRel(unsigned Type = -1) const { return TlsGotRel; }
+ virtual unsigned getTlsGotRel(unsigned Type) const { return TlsGotRel; }
virtual void writeGotHeader(uint8_t *Buf) const {}
virtual void writeGotPltHeader(uint8_t *Buf) const {}
virtual void writeGotPlt(uint8_t *Buf, uint64_t Plt) const {};
Index: lld/trunk/ELF/Target.cpp
===================================================================
--- lld/trunk/ELF/Target.cpp
+++ lld/trunk/ELF/Target.cpp
@@ -114,6 +114,7 @@
class X86_64TargetInfo final : public TargetInfo {
public:
X86_64TargetInfo();
+ unsigned getTlsGotRel(unsigned Type) 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;
@@ -173,7 +174,7 @@
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;
- unsigned getTlsGotRel(unsigned Type = -1) const override;
+ unsigned getTlsGotRel(unsigned Type) const override;
bool isTlsDynRel(unsigned Type, const SymbolBody &S) const override;
bool needsCopyRel(uint32_t Type, const SymbolBody &S) const override;
bool needsGot(uint32_t Type, SymbolBody &S) const override;
@@ -654,6 +655,13 @@
return Type == R_X86_64_GOTPCREL || needsPlt(Type, S);
}
+unsigned X86_64TargetInfo::getTlsGotRel(unsigned 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::isTlsDynRel(unsigned Type, const SymbolBody &S) const {
return Type == R_X86_64_GOTTPOFF || Type == R_X86_64_TLSGD;
}
@@ -789,7 +797,7 @@
0x48, 0x03, 0x05, 0x00, 0x00, 0x00, 0x00 // addq x at tpoff,%rax
};
memcpy(Loc - 4, Inst, sizeof(Inst));
- relocateOne(Loc + 8, BufEnd, R_X86_64_TPOFF64, P + 12, SA);
+ relocateOne(Loc + 8, BufEnd, R_X86_64_PC32, P + 12, SA);
}
// In some conditions, R_X86_64_GOTTPOFF relocation can be optimized to
@@ -896,9 +904,6 @@
write32le(Loc, Val);
break;
}
- case R_X86_64_TPOFF64:
- write32le(Loc, SA - P);
- break;
default:
fatal("unrecognized reloc " + Twine(Type));
}
@@ -1209,10 +1214,9 @@
}
unsigned AArch64TargetInfo::getTlsGotRel(unsigned Type) const {
- if (Type == R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 ||
- Type == R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC)
+ assert(Type == R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 ||
+ Type == R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC);
return Type;
- return TlsGotRel;
}
bool AArch64TargetInfo::isTlsDynRel(unsigned Type, const SymbolBody &S) const {
Index: lld/trunk/ELF/Writer.cpp
===================================================================
--- lld/trunk/ELF/Writer.cpp
+++ lld/trunk/ELF/Writer.cpp
@@ -403,7 +403,7 @@
if (CBP || Dynrel) {
uint32_t DynType;
if (CBP)
- DynType = Body->isTls() ? Target->getTlsGotRel() : Target->GotRel;
+ DynType = Body->isTls() ? Target->TlsGotRel : Target->GotRel;
else
DynType = Target->RelativeRel;
Out<ELFT>::RelaDyn->addReloc(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16880.47622.patch
Type: text/x-patch
Size: 3662 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160211/24f3c417/attachment.bin>
More information about the llvm-commits
mailing list