From ca05b6fb798f2eed32756c7dfc8886411609bdd8 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Thu, 12 Oct 2017 19:10:41 +0000 Subject: [PATCH] Remove Symbol::isPreemptible(). Because it was a redundant accessor to Symbol's public member. llvm-svn: 315609 --- lld/ELF/Relocations.cpp | 12 ++++++------ lld/ELF/Symbols.h | 1 - lld/ELF/SyntheticSections.cpp | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp index 66e50361dab6..c041399bb274 100644 --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -97,7 +97,7 @@ static bool isPreemptible(const SymbolBody &Body, RelType Type) { Type == R_MICROMIPS_GPREL7_S2) return false; } - return Body.isPreemptible(); + return Body.IsPreemptible; } // This function is similar to the `handleTlsRelocation`. MIPS does not @@ -120,11 +120,11 @@ static unsigned handleMipsTlsRelocation(RelType Type, SymbolBody &Body, } if (Expr == R_MIPS_TLSGD) { - if (InX::MipsGot->addDynTlsEntry(Body) && Body.isPreemptible()) { + if (InX::MipsGot->addDynTlsEntry(Body) && Body.IsPreemptible) { uint64_t Off = InX::MipsGot->getGlobalDynOffset(Body); In::RelaDyn->addReloc( {Target->TlsModuleIndexRel, InX::MipsGot, Off, false, &Body, 0}); - if (Body.isPreemptible()) + if (Body.IsPreemptible) In::RelaDyn->addReloc({Target->TlsOffsetRel, InX::MipsGot, Off + Config->Wordsize, false, &Body, 0}); } @@ -155,8 +155,8 @@ static unsigned handleARMTlsRelocation(RelType Type, SymbolBody &Body, // The Dynamic TLS Module Index Relocation for a symbol defined in an // executable is always 1. If the target Symbol is not preemptible then // we know the offset into the TLS block at static link time. - bool NeedDynId = Body.isPreemptible() || Config->Shared; - bool NeedDynOff = Body.isPreemptible(); + bool NeedDynId = Body.IsPreemptible || Config->Shared; + bool NeedDynOff = Body.IsPreemptible; auto AddTlsReloc = [&](uint64_t Off, RelType Type, SymbolBody *Dest, bool Dyn) { @@ -923,7 +923,7 @@ static void scanRelocs(InputSectionBase &Sec, ArrayRef Rels) { // for detailed description: // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf InX::MipsGot->addEntry(Body, Addend, Expr); - if (Body.isTls() && Body.isPreemptible()) + if (Body.isTls() && Body.IsPreemptible) In::RelaDyn->addReloc({Target->TlsGotRel, InX::MipsGot, Body.getGotOffset(), false, &Body, 0}); } else if (!Body.isInGot()) { diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h index 6992679e05ba..a361498a940d 100644 --- a/lld/ELF/Symbols.h +++ b/lld/ELF/Symbols.h @@ -76,7 +76,6 @@ public: bool isUndefWeak() const; InputFile *getFile() const; - bool isPreemptible() const { return IsPreemptible; } StringRef getName() const { return Name; } uint8_t getVisibility() const { return StOther & 0x3; } void parseSymbolVersion(); diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index fc7971e32002..17f0fb0bab5a 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -734,7 +734,7 @@ void MipsGotSection::addEntry(SymbolBody &Sym, int64_t Addend, RelExpr Expr) { if (!A) S.GotIndex = NewIndex; }; - if (Sym.isPreemptible()) { + if (Sym.IsPreemptible) { // Ignore addends for preemptible symbols. They got single GOT entry anyway. AddEntry(Sym, 0, GlobalEntries); Sym.IsInGlobalMipsGot = true; @@ -910,7 +910,7 @@ void MipsGotSection::writeTo(uint8_t *Buf) { if (TlsIndexOff != -1U && !Config->Pic) writeUint(Buf + TlsIndexOff, 1); for (const SymbolBody *B : TlsEntries) { - if (!B || B->isPreemptible()) + if (!B || B->IsPreemptible) continue; uint64_t VA = B->getVA(); if (B->GotIndex != -1U) {