[lld] r259141 - ELF: Remove accessors from Target.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 28 17:49:32 PST 2016


Author: ruiu
Date: Thu Jan 28 19:49:32 2016
New Revision: 259141

URL: http://llvm.org/viewvc/llvm-project?rev=259141&view=rev
Log:
ELF: Remove accessors from Target.

These accessors do not provide values. We can simply make the variables public.

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=259141&r1=259140&r2=259141&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Thu Jan 28 19:49:32 2016
@@ -226,7 +226,7 @@ void InputSectionBase<ELFT>::relocate(ui
       else
         SymVA = Out<ELFT>::Got->getEntryAddr(*Body);
       if (Body->isTls())
-        Type = Target->getTlsGotReloc(Type);
+        Type = Target->getTlsGotRel(Type);
     } else if (!Target->needsCopyRel(Type, *Body) &&
                isa<SharedSymbol<ELFT>>(*Body)) {
       continue;

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=259141&r1=259140&r2=259141&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Thu Jan 28 19:49:32 2016
@@ -39,7 +39,7 @@ GotPltSection<ELFT>::GotPltSection()
 }
 
 template <class ELFT> void GotPltSection<ELFT>::addEntry(SymbolBody *Sym) {
-  Sym->GotPltIndex = Target->getGotPltHeaderEntriesNum() + Entries.size();
+  Sym->GotPltIndex = Target->GotPltHeaderEntriesNum + Entries.size();
   Entries.push_back(Sym);
 }
 
@@ -55,12 +55,12 @@ GotPltSection<ELFT>::getEntryAddr(const
 
 template <class ELFT> void GotPltSection<ELFT>::finalize() {
   this->Header.sh_size =
-      (Target->getGotPltHeaderEntriesNum() + Entries.size()) * sizeof(uintX_t);
+      (Target->GotPltHeaderEntriesNum + Entries.size()) * sizeof(uintX_t);
 }
 
 template <class ELFT> void GotPltSection<ELFT>::writeTo(uint8_t *Buf) {
   Target->writeGotPltHeaderEntries(Buf);
-  Buf += Target->getGotPltHeaderEntriesNum() * sizeof(uintX_t);
+  Buf += Target->GotPltHeaderEntriesNum * sizeof(uintX_t);
   for (const SymbolBody *B : Entries) {
     Target->writeGotPltEntry(Buf, Out<ELFT>::Plt->getEntryAddr(*B));
     Buf += sizeof(uintX_t);
@@ -87,7 +87,7 @@ template <class ELFT> void GotSection<EL
 template <class ELFT> bool GotSection<ELFT>::addDynTlsEntry(SymbolBody *Sym) {
   if (Sym->hasGlobalDynIndex())
     return false;
-  Sym->GlobalDynIndex = Target->getGotHeaderEntriesNum() + Entries.size();
+  Sym->GlobalDynIndex = Target->GotHeaderEntriesNum + Entries.size();
   // Global Dynamic TLS entries take two GOT slots.
   Entries.push_back(Sym);
   Entries.push_back(nullptr);
@@ -107,7 +107,7 @@ template <class ELFT>
 typename GotSection<ELFT>::uintX_t
 GotSection<ELFT>::getEntryAddr(const SymbolBody &B) const {
   return this->getVA() +
-         (Target->getGotHeaderEntriesNum() + MipsLocalEntries + B.GotIndex) *
+         (Target->GotHeaderEntriesNum + MipsLocalEntries + B.GotIndex) *
              sizeof(uintX_t);
 }
 
@@ -128,7 +128,7 @@ GotSection<ELFT>::getMipsLocalPageAddr(u
 template <class ELFT>
 typename GotSection<ELFT>::uintX_t
 GotSection<ELFT>::getMipsLocalEntryAddr(uintX_t EntryValue) {
-  size_t NewIndex = Target->getGotHeaderEntriesNum() + MipsLocalGotPos.size();
+  size_t NewIndex = Target->GotHeaderEntriesNum + MipsLocalGotPos.size();
   auto P = MipsLocalGotPos.insert(std::make_pair(EntryValue, NewIndex));
   assert(!P.second || MipsLocalGotPos.size() <= MipsLocalEntries);
   return this->getVA() + P.first->second * sizeof(uintX_t);
@@ -147,12 +147,12 @@ const SymbolBody *GotSection<ELFT>::getM
 
 template <class ELFT>
 unsigned GotSection<ELFT>::getMipsLocalEntriesNum() const {
-  return Target->getGotHeaderEntriesNum() + MipsLocalEntries;
+  return Target->GotHeaderEntriesNum + MipsLocalEntries;
 }
 
 template <class ELFT> void GotSection<ELFT>::finalize() {
   this->Header.sh_size =
-      (Target->getGotHeaderEntriesNum() + MipsLocalEntries + Entries.size()) *
+      (Target->GotHeaderEntriesNum + MipsLocalEntries + Entries.size()) *
       sizeof(uintX_t);
 }
 
@@ -162,7 +162,7 @@ template <class ELFT> void GotSection<EL
     uint8_t *Entry = Buf + L.second * sizeof(uintX_t);
     write<uintX_t, ELFT::TargetEndianness, sizeof(uintX_t)>(Entry, L.first);
   }
-  Buf += Target->getGotHeaderEntriesNum() * sizeof(uintX_t);
+  Buf += Target->GotHeaderEntriesNum * sizeof(uintX_t);
   Buf += MipsLocalEntries * sizeof(uintX_t);
   for (const SymbolBody *B : Entries) {
     uint8_t *Entry = Buf;
@@ -189,11 +189,11 @@ PltSection<ELFT>::PltSection()
 
 template <class ELFT> void PltSection<ELFT>::writeTo(uint8_t *Buf) {
   size_t Off = 0;
-  bool LazyReloc = Target->supportsLazyRelocations();
+  bool LazyReloc = Target->UseLazyBinding;
   if (LazyReloc) {
     // First write PLT[0] entry which is special.
     Target->writePltZeroEntry(Buf, Out<ELFT>::GotPlt->getVA(), this->getVA());
-    Off += Target->getPltZeroEntrySize();
+    Off += Target->PltZeroEntrySize;
   }
   for (auto &I : Entries) {
     const SymbolBody *E = I.first;
@@ -204,13 +204,13 @@ template <class ELFT> void PltSection<EL
                               : Out<ELFT>::Got->getEntryAddr(*E);
     uint64_t Plt = this->getVA() + Off;
     Target->writePltEntry(Buf + Off, GotVA, GotE, Plt, E->PltIndex, RelOff);
-    Off += Target->getPltEntrySize();
+    Off += Target->PltEntrySize;
   }
 }
 
 template <class ELFT> void PltSection<ELFT>::addEntry(SymbolBody *Sym) {
   Sym->PltIndex = Entries.size();
-  unsigned RelOff = Target->supportsLazyRelocations()
+  unsigned RelOff = Target->UseLazyBinding
                         ? Out<ELFT>::RelaPlt->getRelocOffset()
                         : Out<ELFT>::RelaDyn->getRelocOffset();
   Entries.push_back(std::make_pair(Sym, RelOff));
@@ -219,13 +219,13 @@ template <class ELFT> void PltSection<EL
 template <class ELFT>
 typename PltSection<ELFT>::uintX_t
 PltSection<ELFT>::getEntryAddr(const SymbolBody &B) const {
-  return this->getVA() + Target->getPltZeroEntrySize() +
-         B.PltIndex * Target->getPltEntrySize();
+  return this->getVA() + Target->PltZeroEntrySize +
+         B.PltIndex * Target->PltEntrySize;
 }
 
 template <class ELFT> void PltSection<ELFT>::finalize() {
-  this->Header.sh_size = Target->getPltZeroEntrySize() +
-                         Entries.size() * Target->getPltEntrySize();
+  this->Header.sh_size =
+      Target->PltZeroEntrySize + Entries.size() * Target->PltEntrySize;
 }
 
 template <class ELFT>
@@ -243,7 +243,7 @@ bool RelocationSection<ELFT>::applyTlsDy
                                                    uint32_t Type, Elf_Rel *P,
                                                    Elf_Rel *N) {
   if (Target->isTlsLocalDynamicReloc(Type)) {
-    P->setSymbolAndType(0, Target->getTlsModuleIndexReloc(), Config->Mips64EL);
+    P->setSymbolAndType(0, Target->TlsModuleIndexRel, Config->Mips64EL);
     P->r_offset = Out<ELFT>::Got->getLocalTlsIndexVA();
     return true;
   }
@@ -252,17 +252,17 @@ bool RelocationSection<ELFT>::applyTlsDy
     return false;
 
   if (Target->canRelaxTls(Type, Body)) {
-    P->setSymbolAndType(Body->DynamicSymbolTableIndex,
-                        Target->getTlsGotReloc(), Config->Mips64EL);
+    P->setSymbolAndType(Body->DynamicSymbolTableIndex, Target->getTlsGotRel(),
+                        Config->Mips64EL);
     P->r_offset = Out<ELFT>::Got->getEntryAddr(*Body);
     return true;
   }
 
-  P->setSymbolAndType(Body->DynamicSymbolTableIndex,
-                      Target->getTlsModuleIndexReloc(), Config->Mips64EL);
+  P->setSymbolAndType(Body->DynamicSymbolTableIndex, Target->TlsModuleIndexRel,
+                      Config->Mips64EL);
   P->r_offset = Out<ELFT>::Got->getGlobalDynAddr(*Body);
-  N->setSymbolAndType(Body->DynamicSymbolTableIndex,
-                      Target->getTlsOffsetReloc(), Config->Mips64EL);
+  N->setSymbolAndType(Body->DynamicSymbolTableIndex, Target->TlsOffsetRel,
+                      Config->Mips64EL);
   N->r_offset = Out<ELFT>::Got->getGlobalDynAddr(*Body) + sizeof(uintX_t);
   return true;
 }
@@ -291,7 +291,7 @@ template <class ELFT> void RelocationSec
 
     // Writer::scanRelocs creates a RELATIVE reloc for some type of TLS reloc.
     // We want to write it down as is.
-    if (Type == Target->getRelativeReloc()) {
+    if (Type == Target->RelativeRel) {
       P->setSymbolAndType(0, Type, Config->Mips64EL);
       P->r_offset = C.getOffset(RI.r_offset) + C.OutSec->getVA();
       continue;
@@ -300,7 +300,7 @@ template <class ELFT> void RelocationSec
     // Emit a copy relocation.
     auto *SS = dyn_cast_or_null<SharedSymbol<ELFT>>(Body);
     if (SS && SS->NeedsCopy) {
-      P->setSymbolAndType(Body->DynamicSymbolTableIndex, Target->getCopyReloc(),
+      P->setSymbolAndType(Body->DynamicSymbolTableIndex, Target->CopyRel,
                           Config->Mips64EL);
       P->r_offset = Out<ELFT>::Bss->getVA() + SS->OffsetInBss;
       continue;
@@ -314,7 +314,7 @@ template <class ELFT> void RelocationSec
     // the usual JUMP_SLOT reloc for the GOT entry. For the details, you
     // want to read http://www.airs.com/blog/archives/403
     if (!CBP && Body && isGnuIFunc<ELFT>(*Body)) {
-      P->setSymbolAndType(0, Target->getIRelativeReloc(), Config->Mips64EL);
+      P->setSymbolAndType(0, Target->IRelativeRel, Config->Mips64EL);
       if (Out<ELFT>::GotPlt)
         P->r_offset = Out<ELFT>::GotPlt->getEntryAddr(*Body);
       else
@@ -322,16 +322,16 @@ template <class ELFT> void RelocationSec
       continue;
     }
 
-    bool LazyReloc = Body && Target->supportsLazyRelocations() &&
-                     Target->relocNeedsPlt(Type, *Body);
+    bool LazyReloc =
+        Body && Target->UseLazyBinding && Target->relocNeedsPlt(Type, *Body);
 
     unsigned Reloc;
     if (!CBP)
-      Reloc = Target->getRelativeReloc();
+      Reloc = Target->RelativeRel;
     else if (LazyReloc)
-      Reloc = Target->getPltReloc();
+      Reloc = Target->PltRel;
     else if (NeedsGot)
-      Reloc = Body->isTls() ? Target->getTlsGotReloc() : Target->getGotReloc();
+      Reloc = Body->isTls() ? Target->getTlsGotRel() : Target->GotRel;
     else
       Reloc = Target->getDynReloc(Type);
     P->setSymbolAndType(CBP ? Body->DynamicSymbolTableIndex : 0, Reloc,

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=259141&r1=259140&r2=259141&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Thu Jan 28 19:49:32 2016
@@ -87,7 +87,7 @@ public:
   X86TargetInfo();
   void writeGotPltHeaderEntries(uint8_t *Buf) const override;
   unsigned getDynReloc(unsigned Type) const override;
-  unsigned getTlsGotReloc(unsigned Type) const override;
+  unsigned getTlsGotRel(unsigned Type) const override;
   bool isTlsDynReloc(unsigned Type, const SymbolBody &S) const override;
   void writeGotPltEntry(uint8_t *Buf, uint64_t Plt) const override;
   void writePltZeroEntry(uint8_t *Buf, uint64_t GotEntryAddr,
@@ -198,7 +198,7 @@ public:
   void writePltEntry(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
                      uint64_t PltEntryAddr, int32_t Index,
                      unsigned RelOff) const override;
-  unsigned getTlsGotReloc(unsigned Type = -1) const override;
+  unsigned getTlsGotRel(unsigned Type = -1) const override;
   bool isTlsDynReloc(unsigned 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;
@@ -303,17 +303,17 @@ void TargetInfo::writeGotHeaderEntries(u
 void TargetInfo::writeGotPltHeaderEntries(uint8_t *Buf) const {}
 
 X86TargetInfo::X86TargetInfo() {
-  CopyReloc = R_386_COPY;
-  GotReloc = R_386_GLOB_DAT;
-  PltReloc = R_386_JUMP_SLOT;
-  IRelativeReloc = R_386_IRELATIVE;
-  RelativeReloc = R_386_RELATIVE;
-  TlsGotReloc = R_386_TLS_TPOFF;
-  TlsGlobalDynamicReloc = R_386_TLS_GD;
-  TlsLocalDynamicReloc = R_386_TLS_LDM;
-  TlsModuleIndexReloc = R_386_TLS_DTPMOD32;
-  TlsOffsetReloc = R_386_TLS_DTPOFF32;
-  LazyRelocations = true;
+  CopyRel = R_386_COPY;
+  GotRel = R_386_GLOB_DAT;
+  PltRel = R_386_JUMP_SLOT;
+  IRelativeRel = R_386_IRELATIVE;
+  RelativeRel = R_386_RELATIVE;
+  TlsGotRel = R_386_TLS_TPOFF;
+  TlsGlobalDynamicRel = R_386_TLS_GD;
+  TlsLocalDynamicRel = R_386_TLS_LDM;
+  TlsModuleIndexRel = R_386_TLS_DTPMOD32;
+  TlsOffsetRel = R_386_TLS_DTPOFF32;
+  UseLazyBinding = true;
   PltEntrySize = 16;
   PltZeroEntrySize = 16;
 }
@@ -335,10 +335,10 @@ unsigned X86TargetInfo::getDynReloc(unsi
   return Type;
 }
 
-unsigned X86TargetInfo::getTlsGotReloc(unsigned Type) const {
+unsigned X86TargetInfo::getTlsGotRel(unsigned Type) const {
   if (Type == R_386_TLS_IE)
     return Type;
-  return TlsGotReloc;
+  return TlsGotRel;
 }
 
 bool X86TargetInfo::isTlsDynReloc(unsigned Type, const SymbolBody &S) const {
@@ -608,17 +608,17 @@ void X86TargetInfo::relocateTlsIeToLe(un
 }
 
 X86_64TargetInfo::X86_64TargetInfo() {
-  CopyReloc = R_X86_64_COPY;
-  GotReloc = R_X86_64_GLOB_DAT;
-  PltReloc = R_X86_64_JUMP_SLOT;
-  RelativeReloc = R_X86_64_RELATIVE;
-  IRelativeReloc = R_X86_64_IRELATIVE;
-  TlsGotReloc = R_X86_64_TPOFF64;
-  TlsLocalDynamicReloc = R_X86_64_TLSLD;
-  TlsGlobalDynamicReloc = R_X86_64_TLSGD;
-  TlsModuleIndexReloc = R_X86_64_DTPMOD64;
-  TlsOffsetReloc = R_X86_64_DTPOFF64;
-  LazyRelocations = true;
+  CopyRel = R_X86_64_COPY;
+  GotRel = R_X86_64_GLOB_DAT;
+  PltRel = R_X86_64_JUMP_SLOT;
+  RelativeRel = R_X86_64_RELATIVE;
+  IRelativeRel = R_X86_64_IRELATIVE;
+  TlsGotRel = R_X86_64_TPOFF64;
+  TlsLocalDynamicRel = R_X86_64_TLSLD;
+  TlsGlobalDynamicRel = R_X86_64_TLSGD;
+  TlsModuleIndexRel = R_X86_64_DTPMOD64;
+  TlsOffsetRel = R_X86_64_DTPOFF64;
+  UseLazyBinding = true;
   PltEntrySize = 16;
   PltZeroEntrySize = 16;
 }
@@ -971,8 +971,8 @@ void PPCTargetInfo::relocateOne(uint8_t
 }
 
 PPC64TargetInfo::PPC64TargetInfo() {
-  GotReloc = R_PPC64_GLOB_DAT;
-  RelativeReloc = R_PPC64_RELATIVE;
+  GotRel = R_PPC64_GLOB_DAT;
+  RelativeRel = R_PPC64_RELATIVE;
   PltEntrySize = 32;
 
   // We need 64K pages (at least under glibc/Linux, the loader won't
@@ -1183,12 +1183,12 @@ void PPC64TargetInfo::relocateOne(uint8_
 }
 
 AArch64TargetInfo::AArch64TargetInfo() {
-  CopyReloc = R_AARCH64_COPY;
-  IRelativeReloc = R_AARCH64_IRELATIVE;
-  GotReloc = R_AARCH64_GLOB_DAT;
-  PltReloc = R_AARCH64_JUMP_SLOT;
-  TlsGotReloc = R_AARCH64_TLS_TPREL64;
-  LazyRelocations = true;
+  CopyRel = R_AARCH64_COPY;
+  IRelativeRel = R_AARCH64_IRELATIVE;
+  GotRel = R_AARCH64_GLOB_DAT;
+  PltRel = R_AARCH64_JUMP_SLOT;
+  TlsGotRel = R_AARCH64_TLS_TPREL64;
+  UseLazyBinding = true;
   PltEntrySize = 16;
   PltZeroEntrySize = 32;
 }
@@ -1247,11 +1247,11 @@ void AArch64TargetInfo::writePltEntry(ui
               GotEntryAddr);
 }
 
-unsigned AArch64TargetInfo::getTlsGotReloc(unsigned Type) const {
+unsigned AArch64TargetInfo::getTlsGotRel(unsigned Type) const {
   if (Type == R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 ||
       Type == R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC)
     return Type;
-  return TlsGotReloc;
+  return TlsGotRel;
 }
 
 bool AArch64TargetInfo::isTlsDynReloc(unsigned Type,
@@ -1460,7 +1460,7 @@ void AMDGPUTargetInfo::relocateOne(uint8
 template <class ELFT> MipsTargetInfo<ELFT>::MipsTargetInfo() {
   PageSize = 65536;
   GotHeaderEntriesNum = 2;
-  RelativeReloc = R_MIPS_REL32;
+  RelativeRel = R_MIPS_REL32;
 }
 
 template <class ELFT>

Modified: lld/trunk/ELF/Target.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.h?rev=259141&r1=259140&r2=259141&view=diff
==============================================================================
--- lld/trunk/ELF/Target.h (original)
+++ lld/trunk/ELF/Target.h Thu Jan 28 19:49:32 2016
@@ -21,33 +21,24 @@ class SymbolBody;
 
 class TargetInfo {
 public:
-  unsigned getPageSize() const { return PageSize; }
   uint64_t getVAStart() const;
-  unsigned getCopyReloc() const { return CopyReloc; }
-  unsigned getGotReloc() const { return GotReloc; }
-  unsigned getPltReloc() const { return PltReloc; }
-  unsigned getRelativeReloc() const { return RelativeReloc; }
-  unsigned getIRelativeReloc() const { return IRelativeReloc; }
+
   bool isTlsLocalDynamicReloc(unsigned Type) const {
-    return Type == TlsLocalDynamicReloc;
+    return Type == TlsLocalDynamicRel;
   }
+
   bool isTlsGlobalDynamicReloc(unsigned Type) const {
-    return Type == TlsGlobalDynamicReloc;
+    return Type == TlsGlobalDynamicRel;
   }
-  unsigned getTlsModuleIndexReloc() const { return TlsModuleIndexReloc; }
-  unsigned getTlsOffsetReloc() const { return TlsOffsetReloc; }
-  unsigned getPltZeroEntrySize() const { return PltZeroEntrySize; }
-  unsigned getPltEntrySize() const { return PltEntrySize; }
-  bool supportsLazyRelocations() const { return LazyRelocations; }
-  unsigned getGotHeaderEntriesNum() const { return GotHeaderEntriesNum; }
-  unsigned getGotPltHeaderEntriesNum() const { return GotPltHeaderEntriesNum; }
+
   virtual unsigned getDynReloc(unsigned Type) const { return Type; }
+
   virtual bool isTlsDynReloc(unsigned Type, const SymbolBody &S) const {
     return false;
   }
-  virtual unsigned getTlsGotReloc(unsigned Type = -1) const {
-    return TlsGotReloc;
-  }
+
+  virtual unsigned getTlsGotRel(unsigned Type = -1) const { return TlsGotRel; }
+
   virtual void writeGotHeaderEntries(uint8_t *Buf) const;
   virtual void writeGotPltHeaderEntries(uint8_t *Buf) const;
   virtual void writeGotPltEntry(uint8_t *Buf, uint64_t Plt) const = 0;
@@ -84,7 +75,6 @@ public:
                                        const SymbolBody *S) const;
   virtual ~TargetInfo();
 
-protected:
   unsigned PageSize = 4096;
 
   // On freebsd x86_64 the first page cannot be mmaped.
@@ -95,21 +85,21 @@ protected:
   // 0x200000, but it looks like every OS uses 4k pages for executables.
   uint64_t VAStart = 0x10000;
 
-  unsigned CopyReloc;
-  unsigned GotReloc;
-  unsigned PltReloc;
-  unsigned RelativeReloc;
-  unsigned IRelativeReloc;
-  unsigned TlsGotReloc = 0;
-  unsigned TlsLocalDynamicReloc = 0;
-  unsigned TlsGlobalDynamicReloc = 0;
-  unsigned TlsModuleIndexReloc;
-  unsigned TlsOffsetReloc;
+  unsigned CopyRel;
+  unsigned GotRel;
+  unsigned PltRel;
+  unsigned RelativeRel;
+  unsigned IRelativeRel;
+  unsigned TlsGotRel = 0;
+  unsigned TlsLocalDynamicRel = 0;
+  unsigned TlsGlobalDynamicRel = 0;
+  unsigned TlsModuleIndexRel;
+  unsigned TlsOffsetRel;
   unsigned PltEntrySize = 8;
   unsigned PltZeroEntrySize = 0;
   unsigned GotHeaderEntriesNum = 0;
   unsigned GotPltHeaderEntriesNum = 3;
-  bool LazyRelocations = false;
+  bool UseLazyBinding = false;
 };
 
 uint64_t getPPC64TocBase();

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=259141&r1=259140&r2=259141&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Jan 28 19:49:32 2016
@@ -119,7 +119,7 @@ template <class ELFT> void elf2::writeRe
   GotSection<ELFT> Got;
   Out<ELFT>::Got = &Got;
   GotPltSection<ELFT> GotPlt;
-  if (Target->supportsLazyRelocations())
+  if (Target->UseLazyBinding)
     Out<ELFT>::GotPlt = &GotPlt;
   PltSection<ELFT> Plt;
   Out<ELFT>::Plt = &Plt;
@@ -140,7 +140,7 @@ template <class ELFT> void elf2::writeRe
   RelocationSection<ELFT> RelaDyn(IsRela ? ".rela.dyn" : ".rel.dyn", IsRela);
   Out<ELFT>::RelaDyn = &RelaDyn;
   RelocationSection<ELFT> RelaPlt(IsRela ? ".rela.plt" : ".rel.plt", IsRela);
-  if (Target->supportsLazyRelocations())
+  if (Target->UseLazyBinding)
     Out<ELFT>::RelaPlt = &RelaPlt;
   DynamicSection<ELFT> Dynamic(*Symtab);
   Out<ELFT>::Dynamic = &Dynamic;
@@ -265,7 +265,7 @@ void Writer<ELFT>::scanRelocs(
 
     if (Target->relocNeedsDynRelative(Type)) {
       RelType *Rel = new (Alloc) RelType;
-      Rel->setSymbolAndType(0, Target->getRelativeReloc(), Config->Mips64EL);
+      Rel->setSymbolAndType(0, Target->RelativeRel, Config->Mips64EL);
       Rel->r_offset = RI.r_offset;
       Out<ELFT>::RelaDyn->addReloc({&C, Rel});
     }
@@ -292,7 +292,7 @@ void Writer<ELFT>::scanRelocs(
       }
       NeedsGot = Target->relocNeedsGot(Type, *Body);
       if (NeedsGot) {
-        if (NeedsPlt && Target->supportsLazyRelocations()) {
+        if (NeedsPlt && Target->UseLazyBinding) {
           Out<ELFT>::GotPlt->addEntry(Body);
         } else {
           if (Body->isInGot())
@@ -349,7 +349,7 @@ void Writer<ELFT>::scanRelocs(
 
     if (CBP)
       Body->setUsedInDynamicReloc();
-    if (NeedsPlt && Target->supportsLazyRelocations())
+    if (NeedsPlt && Target->UseLazyBinding)
       Out<ELFT>::RelaPlt->addReloc({&C, &RI});
     else
       Out<ELFT>::RelaDyn->addReloc({&C, &RI});
@@ -1101,7 +1101,7 @@ template <class ELFT> void Writer<ELFT>:
 
   // Add the first PT_LOAD segment for regular output sections.
   setPhdr(&Phdrs[++PhdrIdx], PT_LOAD, PF_R, 0, Target->getVAStart(), FileOff,
-          Target->getPageSize());
+          Target->PageSize);
 
   Elf_Phdr GnuRelroPhdr = {};
   Elf_Phdr TlsPhdr{};
@@ -1115,8 +1115,8 @@ template <class ELFT> void Writer<ELFT>:
       bool InRelRo = Config->ZRelro && (Flags & PF_W) && isRelroSection(Sec);
       bool FirstNonRelRo = GnuRelroPhdr.p_type && !InRelRo && !RelroAligned;
       if (FirstNonRelRo || PH->p_flags != Flags) {
-        VA = alignTo(VA, Target->getPageSize());
-        FileOff = alignTo(FileOff, Target->getPageSize());
+        VA = alignTo(VA, Target->PageSize);
+        FileOff = alignTo(FileOff, Target->PageSize);
         if (FirstNonRelRo)
           RelroAligned = true;
       }
@@ -1126,7 +1126,7 @@ template <class ELFT> void Writer<ELFT>:
         PH = &Phdrs[++PhdrIdx];
         uint32_t PTType = (Config->EMachine != EM_AMDGPU) ? (uint32_t)PT_LOAD
                                                           : getAmdgpuPhdr(Sec);
-        setPhdr(PH, PTType, Flags, FileOff, VA, 0, Target->getPageSize());
+        setPhdr(PH, PTType, Flags, FileOff, VA, 0, Target->PageSize);
       }
 
       if (Sec->getFlags() & SHF_TLS) {




More information about the llvm-commits mailing list