[lld] r275298 - Rename VAStart -> ImageBase. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 11:40:59 PDT 2016


Author: ruiu
Date: Wed Jul 13 13:40:59 2016
New Revision: 275298

URL: http://llvm.org/viewvc/llvm-project?rev=275298&view=rev
Log:
Rename VAStart -> ImageBase. NFC.

Config members are named after corresponding command line options.
This patch renames VAStart ImageBase so that they are in line with
--image-base.

Differential Revision: http://reviews.llvm.org/D22277

Modified:
    lld/trunk/ELF/Config.h
    lld/trunk/ELF/Driver.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/Config.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Config.h?rev=275298&r1=275297&r2=275298&view=diff
==============================================================================
--- lld/trunk/ELF/Config.h (original)
+++ lld/trunk/ELF/Config.h Wed Jul 13 13:40:59 2016
@@ -117,7 +117,7 @@ struct Configuration {
   ELFKind EKind = ELFNoneKind;
   uint16_t EMachine = llvm::ELF::EM_NONE;
   uint64_t EntryAddr = -1;
-  uint64_t VAStart;
+  uint64_t ImageBase;
   unsigned LtoJobs;
   unsigned LtoO;
   unsigned Optimize;

Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=275298&r1=275297&r2=275298&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Wed Jul 13 13:40:59 2016
@@ -535,12 +535,12 @@ template <class ELFT> void LinkerDriver:
 
   if (auto *Arg = Args.getLastArg(OPT_image_base)) {
     StringRef S = Arg->getValue();
-    if (S.getAsInteger(0, Config->VAStart))
+    if (S.getAsInteger(0, Config->ImageBase))
       error(Arg->getSpelling() + ": number expected, but got " + S);
-    else if ((Config->VAStart % Target->PageSize) != 0)
+    else if ((Config->ImageBase % Target->PageSize) != 0)
       warning(Arg->getSpelling() + ": address isn't multiple of page size");
   } else {
-    Config->VAStart = Target->getVAStart();
+    Config->ImageBase = Target->getImageBase();
   }
 
   for (std::unique_ptr<InputFile> &F : Files)

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=275298&r1=275297&r2=275298&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Wed Jul 13 13:40:59 2016
@@ -724,7 +724,7 @@ template <class ELFT> void DynamicSectio
   if (Config->EMachine == EM_MIPS) {
     Add({DT_MIPS_RLD_VERSION, 1});
     Add({DT_MIPS_FLAGS, RHF_NOTPOT});
-    Add({DT_MIPS_BASE_ADDRESS, (uintX_t)Target->getVAStart()});
+    Add({DT_MIPS_BASE_ADDRESS, (uintX_t)Target->getImageBase()});
     Add({DT_MIPS_SYMTABNO, Out<ELFT>::DynSymTab->getNumSymbols()});
     Add({DT_MIPS_LOCAL_GOTNO, Out<ELFT>::Got->getMipsLocalEntriesNum()});
     if (const SymbolBody *B = Out<ELFT>::Got->getMipsFirstGlobalEntry())

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=275298&r1=275297&r2=275298&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Wed Jul 13 13:40:59 2016
@@ -250,7 +250,9 @@ uint64_t TargetInfo::getImplicitAddend(c
   return 0;
 }
 
-uint64_t TargetInfo::getVAStart() const { return Config->Pic ? 0 : VAStart; }
+uint64_t TargetInfo::getImageBase() const {
+  return Config->Pic ? 0 : ImageBase;
+}
 
 bool TargetInfo::usesOnlyLowPageBits(uint32_t Type) const { return false; }
 
@@ -989,7 +991,7 @@ PPC64TargetInfo::PPC64TargetInfo() {
   //
   // And because the lowest non-zero 256M boundary is 0x10000000, PPC64 linkers
   // use 0x10000000 as the starting address.
-  VAStart = 0x10000000;
+  ImageBase = 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=275298&r1=275297&r2=275298&view=diff
==============================================================================
--- lld/trunk/ELF/Target.h (original)
+++ lld/trunk/ELF/Target.h Wed Jul 13 13:40:59 2016
@@ -23,7 +23,7 @@ class SymbolBody;
 
 class TargetInfo {
 public:
-  uint64_t getVAStart() const;
+  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 +70,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 VAStart = 0x10000;
+  uint64_t ImageBase = 0x10000;
 
   uint32_t CopyRel;
   uint32_t GotRel;

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=275298&r1=275297&r2=275298&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Jul 13 13:40:59 2016
@@ -1022,7 +1022,7 @@ template <class ELFT> void Writer<ELFT>:
 // sections. These are special, we do not include them into output sections
 // list, but have them to simplify the code.
 template <class ELFT> void Writer<ELFT>::fixHeaders() {
-  uintX_t BaseVA = ScriptConfig->DoLayout ? 0 : Config->VAStart;
+  uintX_t BaseVA = ScriptConfig->DoLayout ? 0 : Config->ImageBase;
   Out<ELFT>::ElfHeader->setVA(BaseVA);
   uintX_t Off = Out<ELFT>::ElfHeader->getSize();
   Out<ELFT>::ProgramHeaders->setVA(Off + BaseVA);
@@ -1030,7 +1030,7 @@ template <class ELFT> void Writer<ELFT>:
 
 // Assign VAs (addresses at run-time) to output sections.
 template <class ELFT> void Writer<ELFT>::assignAddresses() {
-  uintX_t VA = Config->VAStart + Out<ELFT>::ElfHeader->getSize() +
+  uintX_t VA = Config->ImageBase + Out<ELFT>::ElfHeader->getSize() +
                Out<ELFT>::ProgramHeaders->getSize();
 
   uintX_t ThreadBssOffset = 0;




More information about the llvm-commits mailing list