[lld] r252593 - [ELF2] Remove Writer::getVAStart, use TargetInfo::getVAStart instead.

Igor Kudrin via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 10 00:39:49 PST 2015


Author: ikudrin
Date: Tue Nov 10 02:39:27 2015
New Revision: 252593

URL: http://llvm.org/viewvc/llvm-project?rev=252593&view=rev
Log:
[ELF2] Remove Writer::getVAStart, use TargetInfo::getVAStart instead.

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=252593&r1=252592&r2=252593&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Tue Nov 10 02:39:27 2015
@@ -145,6 +145,8 @@ TargetInfo *createTarget() {
 
 TargetInfo::~TargetInfo() {}
 
+uint64_t TargetInfo::getVAStart() const { return Config->Shared ? 0 : VAStart; }
+
 bool TargetInfo::relocNeedsCopy(uint32_t Type, const SymbolBody &S) const {
   return false;
 }

Modified: lld/trunk/ELF/Target.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.h?rev=252593&r1=252592&r2=252593&view=diff
==============================================================================
--- lld/trunk/ELF/Target.h (original)
+++ lld/trunk/ELF/Target.h Tue Nov 10 02:39:27 2015
@@ -22,7 +22,7 @@ class SymbolBody;
 class TargetInfo {
 public:
   unsigned getPageSize() const { return PageSize; }
-  uint64_t getVAStart() const { return VAStart; }
+  uint64_t getVAStart() const;
   unsigned getCopyReloc() const { return CopyReloc; }
   unsigned getPCRelReloc() const { return PCRelReloc; }
   unsigned getGotReloc() const { return GotReloc; }

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=252593&r1=252592&r2=252593&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Tue Nov 10 02:39:27 2015
@@ -55,7 +55,6 @@ private:
   bool isOutputDynamic() const {
     return !Symtab.getSharedFiles().empty() || Config->Shared;
   }
-  uintX_t getVAStart() const { return Config->Shared ? 0 : Target->getVAStart(); }
   uintX_t getEntryAddr() const;
   int getPhdrsNum() const;
 
@@ -677,7 +676,7 @@ static uint32_t toPhdrFlags(uint64_t Fla
 // Visits all sections to create PHDRs and to assign incremental,
 // non-overlapping addresses to output sections.
 template <class ELFT> void Writer<ELFT>::assignAddresses() {
-  uintX_t VA = getVAStart() + sizeof(Elf_Ehdr);
+  uintX_t VA = Target->getVAStart() + sizeof(Elf_Ehdr);
   uintX_t FileOff = sizeof(Elf_Ehdr);
 
   // Calculate and reserve the space for the program header first so that
@@ -697,7 +696,7 @@ template <class ELFT> void Writer<ELFT>:
     Interp = &Phdrs[++PhdrIdx];
 
   // Add the first PT_LOAD segment for regular output sections.
-  setPhdr(&Phdrs[++PhdrIdx], PT_LOAD, PF_R, 0, getVAStart(), FileOff,
+  setPhdr(&Phdrs[++PhdrIdx], PT_LOAD, PF_R, 0, Target->getVAStart(), FileOff,
           Target->getPageSize());
 
   Elf_Phdr TlsPhdr{};




More information about the llvm-commits mailing list