[lld] r267886 - Rename isRelRelative

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 07:34:39 PDT 2016


Author: rafael
Date: Thu Apr 28 09:34:39 2016
New Revision: 267886

URL: http://llvm.org/viewvc/llvm-project?rev=267886&view=rev
Log:
Rename isRelRelative

It was never a particularly good name and is now completely out of date.

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

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=267886&r1=267885&r2=267886&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Thu Apr 28 09:34:39 2016
@@ -149,7 +149,7 @@ public:
   void writePlt(uint8_t *Buf, uint64_t GotEntryAddr, uint64_t PltEntryAddr,
                 int32_t Index, unsigned RelOff) const override;
   uint32_t getTlsGotRel(uint32_t Type) const override;
-  bool isRelRelative(uint32_t Type) const override;
+  bool usesOnlyLowPageBits(uint32_t Type) const override;
   void relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const override;
   void relaxTlsGdToLe(uint8_t *Loc, uint32_t Type, uint64_t Val) const override;
   void relaxTlsIeToLe(uint8_t *Loc, uint32_t Type, uint64_t Val) const override;
@@ -180,7 +180,7 @@ public:
                   const SymbolBody &S) const override;
   void relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const override;
   bool isHintRel(uint32_t Type) const override;
-  bool isRelRelative(uint32_t Type) const override;
+  bool usesOnlyLowPageBits(uint32_t Type) const override;
 };
 } // anonymous namespace
 
@@ -221,7 +221,7 @@ uint64_t TargetInfo::getImplicitAddend(c
 uint64_t TargetInfo::getVAStart() const { return Config->Pic ? 0 : VAStart; }
 
 bool TargetInfo::isHintRel(uint32_t Type) const { return false; }
-bool TargetInfo::isRelRelative(uint32_t Type) const { return false; }
+bool TargetInfo::usesOnlyLowPageBits(uint32_t Type) const { return false; }
 
 bool TargetInfo::needsThunk(uint32_t Type, const InputFile &File,
                             const SymbolBody &S) const {
@@ -978,7 +978,7 @@ RelExpr AArch64TargetInfo::getRelExpr(ui
   }
 }
 
-bool AArch64TargetInfo::isRelRelative(uint32_t Type) const {
+bool AArch64TargetInfo::usesOnlyLowPageBits(uint32_t Type) const {
   switch (Type) {
   default:
     return false;
@@ -1536,7 +1536,7 @@ bool MipsTargetInfo<ELFT>::isHintRel(uin
 }
 
 template <class ELFT>
-bool MipsTargetInfo<ELFT>::isRelRelative(uint32_t Type) const {
+bool MipsTargetInfo<ELFT>::usesOnlyLowPageBits(uint32_t Type) const {
   return Type == R_MIPS_LO16;
 }
 }

Modified: lld/trunk/ELF/Target.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.h?rev=267886&r1=267885&r2=267886&view=diff
==============================================================================
--- lld/trunk/ELF/Target.h (original)
+++ lld/trunk/ELF/Target.h Thu Apr 28 09:34:39 2016
@@ -47,12 +47,12 @@ public:
   // ones and lead to dynamic relocation creation etc.
   virtual bool isHintRel(uint32_t Type) const;
 
-  // Returns true if a relocation is relative to the place being relocated,
-  // such as relocations used for PC-relative instructions. Such relocations
-  // need not be fixed up if an image is loaded to a different address than
-  // the link-time address. So we don't have to emit a relocation for the
-  // dynamic linker if isRelRelative returns true.
-  virtual bool isRelRelative(uint32_t Type) const;
+  // Returns true if a relocation only uses the low bits of a value such that
+  // all those bits are in in the same page. For example, if the relocation
+  // only uses the low 12 bits in a system with 4k pages. If this is true, the
+  // bits will always have the same value at runtime and we don't have to emit
+  // a dynamic relocation.
+  virtual bool usesOnlyLowPageBits(uint32_t Type) const;
 
   virtual bool needsThunk(uint32_t Type, const InputFile &File,
                           const SymbolBody &S) const;

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=267886&r1=267885&r2=267886&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Apr 28 09:34:39 2016
@@ -512,7 +512,7 @@ static bool isRelRelative(RelExpr E, uin
   if (!AbsVal && RelE)
     return true;
 
-  return Target->isRelRelative(Type);
+  return Target->usesOnlyLowPageBits(Type);
 }
 
 // The reason we have to do this early scan is as follows




More information about the llvm-commits mailing list