summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/ELF/InputSection.cpp4
-rw-r--r--lld/ELF/OutputSections.cpp4
-rw-r--r--lld/ELF/Target.h8
-rw-r--r--lld/ELF/Writer.cpp4
4 files changed, 12 insertions, 8 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index afb373decc6..0896d04efb7 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -108,7 +108,7 @@ void InputSectionBase<ELFT>::relocate(
uint8_t *BufLoc = Buf + Offset;
uintX_t AddrLoc = OutSec->getVA() + Offset;
- if (Type == Target->getTlsLocalDynamicReloc()) {
+ if (Target->isTlsLocalDynamicReloc(Type)) {
Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc,
Out<ELFT>::Got->getVA() +
Out<ELFT>::LocalModuleTlsIndexOffset +
@@ -127,7 +127,7 @@ void InputSectionBase<ELFT>::relocate(
SymbolBody &Body = *File->getSymbolBody(SymIndex)->repl();
- if (Type == Target->getTlsGlobalDynamicReloc()) {
+ if (Target->isTlsGlobalDynamicReloc(Type)) {
Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc,
Out<ELFT>::Got->getEntryAddr(Body) +
getAddend<ELFT>(RI));
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index 9def8708595..e4de54e79e0 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -205,7 +205,7 @@ template <class ELFT> void RelocationSection<ELFT>::writeTo(uint8_t *Buf) {
uint32_t Type = RI.getType(Config->Mips64EL);
- if (Type == Target->getTlsLocalDynamicReloc()) {
+ if (Target->isTlsLocalDynamicReloc(Type)) {
P->setSymbolAndType(0, Target->getTlsModuleIndexReloc(),
Config->Mips64EL);
P->r_offset =
@@ -213,7 +213,7 @@ template <class ELFT> void RelocationSection<ELFT>::writeTo(uint8_t *Buf) {
continue;
}
- if (Body && Type == Target->getTlsGlobalDynamicReloc()) {
+ if (Body && Target->isTlsGlobalDynamicReloc(Type)) {
P->setSymbolAndType(Body->getDynamicSymbolTableIndex(),
Target->getTlsModuleIndexReloc(), Config->Mips64EL);
P->r_offset = Out<ELFT>::Got->getEntryAddr(*Body);
diff --git a/lld/ELF/Target.h b/lld/ELF/Target.h
index 55ea6146b15..578aab8cdb1 100644
--- a/lld/ELF/Target.h
+++ b/lld/ELF/Target.h
@@ -29,8 +29,12 @@ public:
unsigned getPltReloc() const { return PltReloc; }
unsigned getGotRefReloc() const { return GotRefReloc; }
unsigned getRelativeReloc() const { return RelativeReloc; }
- unsigned getTlsLocalDynamicReloc() const { return TlsLocalDynamicReloc; }
- unsigned getTlsGlobalDynamicReloc() const { return TlsGlobalDynamicReloc; }
+ bool isTlsLocalDynamicReloc(unsigned Type) const {
+ return Type == TlsLocalDynamicReloc;
+ }
+ bool isTlsGlobalDynamicReloc(unsigned Type) const {
+ return Type == TlsGlobalDynamicReloc;
+ }
unsigned getTlsModuleIndexReloc() const { return TlsModuleIndexReloc; }
unsigned getTlsOffsetReloc() const { return TlsOffsetReloc; }
unsigned getPltZeroEntrySize() const { return PltZeroEntrySize; }
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 4772bec3a6d..975a21628e2 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -199,7 +199,7 @@ void Writer<ELFT>::scanRelocs(
SymbolBody *Body = File.getSymbolBody(SymIndex);
uint32_t Type = RI.getType(Config->Mips64EL);
- if (Type == Target->getTlsLocalDynamicReloc()) {
+ if (Target->isTlsLocalDynamicReloc(Type)) {
if (Out<ELFT>::LocalModuleTlsIndexOffset == uint32_t(-1)) {
Out<ELFT>::LocalModuleTlsIndexOffset =
Out<ELFT>::Got->addLocalModuleTlsIndex();
@@ -217,7 +217,7 @@ void Writer<ELFT>::scanRelocs(
Body = Body->repl();
if (Body && Body->isTLS()) {
- if (Type != Target->getTlsGlobalDynamicReloc())
+ if (!Target->isTlsGlobalDynamicReloc(Type))
continue;
if (Body->isInGot())
continue;
OpenPOWER on IntegriCloud