[lld] r315609 - Remove Symbol::isPreemptible().

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 12 12:10:41 PDT 2017


Author: ruiu
Date: Thu Oct 12 12:10:41 2017
New Revision: 315609

URL: http://llvm.org/viewvc/llvm-project?rev=315609&view=rev
Log:
Remove Symbol::isPreemptible().

Because it was a redundant accessor to Symbol's public member.

Modified:
    lld/trunk/ELF/Relocations.cpp
    lld/trunk/ELF/Symbols.h
    lld/trunk/ELF/SyntheticSections.cpp

Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=315609&r1=315608&r2=315609&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Thu Oct 12 12:10:41 2017
@@ -97,7 +97,7 @@ static bool isPreemptible(const SymbolBo
         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(
   }
 
   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<ELFT>::RelaDyn->addReloc(
           {Target->TlsModuleIndexRel, InX::MipsGot, Off, false, &Body, 0});
-      if (Body.isPreemptible())
+      if (Body.IsPreemptible)
         In<ELFT>::RelaDyn->addReloc({Target->TlsOffsetRel, InX::MipsGot,
                                      Off + Config->Wordsize, false, &Body, 0});
     }
@@ -155,8 +155,8 @@ static unsigned handleARMTlsRelocation(R
   // 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
         // 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<ELFT>::RelaDyn->addReloc({Target->TlsGotRel, InX::MipsGot,
                                        Body.getGotOffset(), false, &Body, 0});
       } else if (!Body.isInGot()) {

Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=315609&r1=315608&r2=315609&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Thu Oct 12 12:10:41 2017
@@ -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();

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=315609&r1=315608&r2=315609&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Thu Oct 12 12:10:41 2017
@@ -734,7 +734,7 @@ void MipsGotSection::addEntry(SymbolBody
     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 *Bu
   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) {




More information about the llvm-commits mailing list