summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2016-01-29 00:20:12 +0000
committerRui Ueyama <ruiu@google.com>2016-01-29 00:20:12 +0000
commitbaf16512ea3187a38b8f7a0298b8c4c2f0741ae5 (patch)
tree64311d2bbb0ce63049b9a64168b7f205972aeb00
parent0e36e09b9c7306821b46d1f2ba59c6d78db977f2 (diff)
downloadbcm5719-llvm-baf16512ea3187a38b8f7a0298b8c4c2f0741ae5.tar.gz
bcm5719-llvm-baf16512ea3187a38b8f7a0298b8c4c2f0741ae5.zip
Rename isTlsOptimized -> canRelaxTls.
This function is a predicate that a given relocation can be relaxed. The previous name implied that it returns true if a given relocation has already been optimized away. llvm-svn: 259128
-rw-r--r--lld/ELF/InputSection.cpp6
-rw-r--r--lld/ELF/OutputSections.cpp2
-rw-r--r--lld/ELF/Target.cpp19
-rw-r--r--lld/ELF/Target.h2
-rw-r--r--lld/ELF/Writer.cpp4
5 files changed, 16 insertions, 17 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index 3d242207859..8c185f8a572 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -156,7 +156,7 @@ void InputSectionBase<ELFT>::relocate(uint8_t *Buf, uint8_t *BufEnd,
auto NextRelocs = llvm::make_range(&RI, Rels.end());
if (Target->isTlsLocalDynamicReloc(Type) &&
- !Target->isTlsOptimized(Type, nullptr)) {
+ !Target->canRelaxTls(Type, nullptr)) {
Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc,
Out<ELFT>::Got->getLocalTlsIndexVA() +
getAddend<ELFT>(RI));
@@ -168,7 +168,7 @@ void InputSectionBase<ELFT>::relocate(uint8_t *Buf, uint8_t *BufEnd,
if (SymIndex >= SymTab->sh_info)
Body = File->getSymbolBody(SymIndex)->repl();
- if (Target->isTlsOptimized(Type, Body)) {
+ if (Target->canRelaxTls(Type, Body)) {
uintX_t SymVA;
if (!Body)
SymVA = getLocalRelTarget(*File, RI, 0);
@@ -207,7 +207,7 @@ void InputSectionBase<ELFT>::relocate(uint8_t *Buf, uint8_t *BufEnd,
}
if (Target->isTlsGlobalDynamicReloc(Type) &&
- !Target->isTlsOptimized(Type, Body)) {
+ !Target->canRelaxTls(Type, Body)) {
Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc,
Out<ELFT>::Got->getGlobalDynAddr(*Body) +
getAddend<ELFT>(RI));
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index 76fb2ea4fa6..7602097a973 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -251,7 +251,7 @@ bool RelocationSection<ELFT>::applyTlsDynamicReloc(SymbolBody *Body,
if (!Body || !Target->isTlsGlobalDynamicReloc(Type))
return false;
- if (Target->isTlsOptimized(Type, Body)) {
+ if (Target->canRelaxTls(Type, Body)) {
P->setSymbolAndType(Body->DynamicSymbolTableIndex,
Target->getTlsGotReloc(), Config->Mips64EL);
P->r_offset = Out<ELFT>::Got->getEntryAddr(*Body);
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp
index 808f2850e24..483458bb6d3 100644
--- a/lld/ELF/Target.cpp
+++ b/lld/ELF/Target.cpp
@@ -102,7 +102,7 @@ public:
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 isTlsOptimized(unsigned Type, const SymbolBody *S) 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;
@@ -137,7 +137,7 @@ public:
uint64_t SA, uint64_t ZA = 0,
uint8_t *PairedLoc = nullptr) const override;
bool isRelRelative(uint32_t Type) const override;
- bool isTlsOptimized(unsigned Type, const SymbolBody *S) 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,
@@ -274,7 +274,7 @@ TargetInfo *createTarget() {
TargetInfo::~TargetInfo() {}
-bool TargetInfo::isTlsOptimized(unsigned Type, const SymbolBody *S) const {
+bool TargetInfo::canRelaxTls(unsigned Type, const SymbolBody *S) const {
return false;
}
@@ -400,9 +400,9 @@ bool X86TargetInfo::needsCopyRel(uint32_t Type, const SymbolBody &S) const {
bool X86TargetInfo::relocNeedsGot(uint32_t Type, const SymbolBody &S) const {
if (S.isTls() && Type == R_386_TLS_GD)
- return Target->isTlsOptimized(Type, &S) && canBePreempted(&S, true);
+ return Target->canRelaxTls(Type, &S) && canBePreempted(&S, true);
if (Type == R_386_TLS_GOTIE || Type == R_386_TLS_IE)
- return !isTlsOptimized(Type, &S);
+ return !canRelaxTls(Type, &S);
return Type == R_386_GOT32 || relocNeedsPlt(Type, S);
}
@@ -467,7 +467,7 @@ void X86TargetInfo::relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,
}
}
-bool X86TargetInfo::isTlsOptimized(unsigned Type, const SymbolBody *S) const {
+bool X86TargetInfo::canRelaxTls(unsigned Type, const SymbolBody *S) const {
if (Config->Shared || (S && !S->isTls()))
return false;
return Type == R_386_TLS_LDO_32 || Type == R_386_TLS_LDM ||
@@ -672,9 +672,9 @@ bool X86_64TargetInfo::needsCopyRel(uint32_t Type, const SymbolBody &S) const {
bool X86_64TargetInfo::relocNeedsGot(uint32_t Type, const SymbolBody &S) const {
if (Type == R_X86_64_TLSGD)
- return Target->isTlsOptimized(Type, &S) && canBePreempted(&S, true);
+ return Target->canRelaxTls(Type, &S) && canBePreempted(&S, true);
if (Type == R_X86_64_GOTTPOFF)
- return !isTlsOptimized(Type, &S);
+ return !canRelaxTls(Type, &S);
return Type == R_X86_64_GOTPCREL || relocNeedsPlt(Type, S);
}
@@ -743,8 +743,7 @@ bool X86_64TargetInfo::isSizeReloc(uint32_t Type) const {
return Type == R_X86_64_SIZE32 || Type == R_X86_64_SIZE64;
}
-bool X86_64TargetInfo::isTlsOptimized(unsigned Type,
- const SymbolBody *S) const {
+bool X86_64TargetInfo::canRelaxTls(unsigned Type, const SymbolBody *S) const {
if (Config->Shared || (S && !S->isTls()))
return false;
return Type == R_X86_64_TLSGD || Type == R_X86_64_TLSLD ||
diff --git a/lld/ELF/Target.h b/lld/ELF/Target.h
index f06b90ed551..00359c08859 100644
--- a/lld/ELF/Target.h
+++ b/lld/ELF/Target.h
@@ -77,7 +77,7 @@ public:
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 isTlsOptimized(unsigned Type, const SymbolBody *S) 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,
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 41af0e371ab..239f6a6433f 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -201,7 +201,7 @@ template <class ELFT, class RelT>
static bool handleTlsRelocation(unsigned Type, SymbolBody *Body,
InputSectionBase<ELFT> &C, RelT &RI) {
if (Target->isTlsLocalDynamicReloc(Type)) {
- if (Target->isTlsOptimized(Type, nullptr))
+ if (Target->canRelaxTls(Type, nullptr))
return true;
if (Out<ELFT>::Got->addCurrentModuleTlsIndex())
Out<ELFT>::RelaDyn->addReloc({&C, &RI});
@@ -212,7 +212,7 @@ static bool handleTlsRelocation(unsigned Type, SymbolBody *Body,
return false;
if (Target->isTlsGlobalDynamicReloc(Type)) {
- bool Opt = Target->isTlsOptimized(Type, Body);
+ bool Opt = Target->canRelaxTls(Type, Body);
if (!Opt && Out<ELFT>::Got->addDynTlsEntry(Body)) {
Out<ELFT>::RelaDyn->addReloc({&C, &RI});
Out<ELFT>::RelaDyn->addReloc({nullptr, nullptr});
OpenPOWER on IntegriCloud