[lld] r275447 - Remove TargetInfo::getImageBase. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 14 10:43:28 PDT 2016


Author: ruiu
Date: Thu Jul 14 12:43:28 2016
New Revision: 275447

URL: http://llvm.org/viewvc/llvm-project?rev=275447&view=rev
Log:
Remove TargetInfo::getImageBase. NFC.

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

Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=275447&r1=275446&r2=275447&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Thu Jul 14 12:43:28 2016
@@ -535,6 +535,7 @@ template <class ELFT> void LinkerDriver:
       Config->EntrySym = Symtab.addUndefined(S);
   }
 
+  // Initialize Config->ImageBase.
   if (auto *Arg = Args.getLastArg(OPT_image_base)) {
     StringRef S = Arg->getValue();
     if (S.getAsInteger(0, Config->ImageBase))
@@ -542,7 +543,7 @@ template <class ELFT> void LinkerDriver:
     else if ((Config->ImageBase % Target->PageSize) != 0)
       warning(Arg->getSpelling() + ": address isn't multiple of page size");
   } else {
-    Config->ImageBase = Target->getImageBase();
+    Config->ImageBase = Config->Pic ? 0 : Target->DefaultImageBase;
   }
 
   for (std::unique_ptr<InputFile> &F : Files)

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=275447&r1=275446&r2=275447&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Thu Jul 14 12:43:28 2016
@@ -250,10 +250,6 @@ uint64_t TargetInfo::getImplicitAddend(c
   return 0;
 }
 
-uint64_t TargetInfo::getImageBase() const {
-  return Config->Pic ? 0 : ImageBase;
-}
-
 bool TargetInfo::usesOnlyLowPageBits(uint32_t Type) const { return false; }
 
 RelExpr TargetInfo::getThunkExpr(RelExpr Expr, uint32_t RelocType,
@@ -997,7 +993,7 @@ PPC64TargetInfo::PPC64TargetInfo() {
   //
   // And because the lowest non-zero 256M boundary is 0x10000000, PPC64 linkers
   // use 0x10000000 as the starting address.
-  ImageBase = 0x10000000;
+  DefaultImageBase = 0x10000000;
 }
 
 static uint64_t PPC64TocOffset = 0x8000;

Modified: lld/trunk/ELF/Target.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.h?rev=275447&r1=275446&r2=275447&view=diff
==============================================================================
--- lld/trunk/ELF/Target.h (original)
+++ lld/trunk/ELF/Target.h Thu Jul 14 12:43:28 2016
@@ -23,7 +23,6 @@ class SymbolBody;
 
 class TargetInfo {
 public:
-  uint64_t getImageBase() const;
   virtual bool isTlsInitialExecRel(uint32_t Type) const;
   virtual bool isTlsLocalDynamicRel(uint32_t Type) const;
   virtual bool isTlsGlobalDynamicRel(uint32_t Type) const;
@@ -70,7 +69,7 @@ public:
   // Given that, the smallest value that can be used in here is 0x10000.
   // If using 2MB pages, the smallest page aligned address that works is
   // 0x200000, but it looks like every OS uses 4k pages for executables.
-  uint64_t ImageBase = 0x10000;
+  uint64_t DefaultImageBase = 0x10000;
 
   uint32_t CopyRel;
   uint32_t GotRel;




More information about the llvm-commits mailing list