[lld] r255866 - ELF: Rename relocNeedsCopy -> needsCopyRel

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 16 17:18:41 PST 2015


Author: ruiu
Date: Wed Dec 16 19:18:40 2015
New Revision: 255866

URL: http://llvm.org/viewvc/llvm-project?rev=255866&view=rev
Log:
ELF: Rename relocNeedsCopy -> needsCopyRel

Just "copy" was a bit too ambiguous to say about copy relocations.

Modified:
    lld/trunk/ELF/InputSection.cpp
    lld/trunk/ELF/OutputSections.cpp
    lld/trunk/ELF/Target.cpp
    lld/trunk/ELF/Target.h
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=255866&r1=255865&r2=255866&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Wed Dec 16 19:18:40 2015
@@ -199,7 +199,7 @@ void InputSectionBase<ELFT>::relocate(ui
       SymVA = Out<ELFT>::Got->getEntryAddr(Body);
       if (Body.isTls())
         Type = Target->getTlsGotReloc();
-    } else if (!Target->relocNeedsCopy(Type, Body) &&
+    } else if (!Target->needsCopyRel(Type, Body) &&
                isa<SharedSymbol<ELFT>>(Body)) {
       continue;
     } else if (Target->isTlsDynReloc(Type) ||

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=255866&r1=255865&r2=255866&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Wed Dec 16 19:18:40 2015
@@ -258,7 +258,7 @@ template <class ELFT> void RelocationSec
     uint32_t Type = RI.getType(Config->Mips64EL);
     if (applyTlsDynamicReloc(Body, Type, P, reinterpret_cast<Elf_Rel *>(Buf)))
       continue;
-    bool NeedsCopy = Body && Target->relocNeedsCopy(Type, *Body);
+    bool NeedsCopy = Body && Target->needsCopyRel(Type, *Body);
     bool NeedsGot = Body && Target->relocNeedsGot(Type, *Body);
     bool CanBePreempted = canBePreempted(Body, NeedsGot);
     bool LazyReloc = Body && Target->supportsLazyRelocations() &&

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=255866&r1=255865&r2=255866&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Wed Dec 16 19:18:40 2015
@@ -83,7 +83,7 @@ public:
   void writePltEntry(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
                      uint64_t PltEntryAddr, int32_t Index,
                      unsigned RelOff) const override;
-  bool relocNeedsCopy(uint32_t Type, const SymbolBody &S) const override;
+  bool needsCopyRel(uint32_t Type, const SymbolBody &S) const override;
   bool relocNeedsGot(uint32_t Type, const SymbolBody &S) const override;
   bool relocNeedsPlt(uint32_t Type, const SymbolBody &S) const override;
   void relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type, uint64_t P,
@@ -117,7 +117,7 @@ public:
   void writePltEntry(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
                      uint64_t PltEntryAddr, int32_t Index,
                      unsigned RelOff) const override;
-  bool relocNeedsCopy(uint32_t Type, const SymbolBody &S) const override;
+  bool needsCopyRel(uint32_t Type, const SymbolBody &S) const override;
   bool relocNeedsGot(uint32_t Type, const SymbolBody &S) const override;
   bool relocNeedsPlt(uint32_t Type, const SymbolBody &S) const override;
   void relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type, uint64_t P,
@@ -169,7 +169,7 @@ public:
   void writePltEntry(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
                      uint64_t PltEntryAddr, int32_t Index,
                      unsigned RelOff) const override;
-  bool relocNeedsCopy(uint32_t Type, const SymbolBody &S) const override;
+  bool needsCopyRel(uint32_t Type, const SymbolBody &S) const override;
   bool relocNeedsGot(uint32_t Type, const SymbolBody &S) const override;
   bool relocNeedsPlt(uint32_t Type, const SymbolBody &S) const override;
   void relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type, uint64_t P,
@@ -226,7 +226,7 @@ bool TargetInfo::isTlsOptimized(unsigned
 
 uint64_t TargetInfo::getVAStart() const { return Config->Shared ? 0 : VAStart; }
 
-bool TargetInfo::relocNeedsCopy(uint32_t Type, const SymbolBody &S) const {
+bool TargetInfo::needsCopyRel(uint32_t Type, const SymbolBody &S) const {
   return false;
 }
 
@@ -327,7 +327,7 @@ void X86TargetInfo::writePltEntry(uint8_
   write32le(Buf + 12, -Index * PltEntrySize - PltZeroEntrySize - 16);
 }
 
-bool X86TargetInfo::relocNeedsCopy(uint32_t Type, const SymbolBody &S) const {
+bool X86TargetInfo::needsCopyRel(uint32_t Type, const SymbolBody &S) const {
   if (Type == R_386_32 || Type == R_386_16 || Type == R_386_8)
     if (auto *SS = dyn_cast<SharedSymbol<ELF32LE>>(&S))
       return SS->Sym.getType() == STT_OBJECT;
@@ -555,8 +555,7 @@ void X86_64TargetInfo::writePltEntry(uin
   write32le(Buf + 12, -Index * PltEntrySize - PltZeroEntrySize - 16);
 }
 
-bool X86_64TargetInfo::relocNeedsCopy(uint32_t Type,
-                                      const SymbolBody &S) const {
+bool X86_64TargetInfo::needsCopyRel(uint32_t Type, const SymbolBody &S) const {
   if (Type == R_X86_64_32S || Type == R_X86_64_32 || Type == R_X86_64_PC32 ||
       Type == R_X86_64_64)
     if (auto *SS = dyn_cast<SharedSymbol<ELF64LE>>(&S))
@@ -583,7 +582,7 @@ unsigned X86_64TargetInfo::getPltRefRelo
 }
 
 bool X86_64TargetInfo::relocNeedsPlt(uint32_t Type, const SymbolBody &S) const {
-  if (relocNeedsCopy(Type, S))
+  if (needsCopyRel(Type, S))
     return false;
 
   switch (Type) {
@@ -1122,8 +1121,7 @@ void AArch64TargetInfo::writePltEntry(ui
               GotEntryAddr);
 }
 
-bool AArch64TargetInfo::relocNeedsCopy(uint32_t Type,
-                                       const SymbolBody &S) const {
+bool AArch64TargetInfo::needsCopyRel(uint32_t Type, const SymbolBody &S) const {
   if (Config->Shared)
     return false;
   switch (Type) {

Modified: lld/trunk/ELF/Target.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.h?rev=255866&r1=255865&r2=255866&view=diff
==============================================================================
--- lld/trunk/ELF/Target.h (original)
+++ lld/trunk/ELF/Target.h Wed Dec 16 19:18:40 2015
@@ -54,13 +54,13 @@ public:
                              int32_t Index, unsigned RelOff) const = 0;
   virtual bool isRelRelative(uint32_t Type) const;
   virtual bool isSizeDynReloc(uint32_t Type, const SymbolBody &S) const;
-  virtual bool relocNeedsCopy(uint32_t Type, const SymbolBody &S) const;
   virtual bool relocNeedsGot(uint32_t Type, const SymbolBody &S) const = 0;
   virtual bool relocNeedsPlt(uint32_t Type, const SymbolBody &S) const = 0;
   virtual 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 = 0;
   virtual bool isTlsOptimized(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,
                                        const SymbolBody &S) const;

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=255866&r1=255865&r2=255866&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Dec 16 19:18:40 2015
@@ -245,7 +245,7 @@ void Writer<ELFT>::scanRelocs(
       if (auto *E = dyn_cast<SharedSymbol<ELFT>>(Body)) {
         if (E->NeedsCopy)
           continue;
-        if (Target->relocNeedsCopy(Type, *Body))
+        if (Target->needsCopyRel(Type, *Body))
           E->NeedsCopy = true;
       }
       NeedsPlt = Target->relocNeedsPlt(Type, *Body);




More information about the llvm-commits mailing list