[lld] r257203 - ELF: Remove dead code.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 8 12:11:47 PST 2016


Author: ruiu
Date: Fri Jan  8 14:11:47 2016
New Revision: 257203

URL: http://llvm.org/viewvc/llvm-project?rev=257203&view=rev
Log:
ELF: Remove dead code.

R_X86_64_PLT32 is handled in the same way as R_X86_64_PC32 by
relocateOne(), so this function does not seems to be needed.
Without this code, all tests still pass.

http://reviews.llvm.org/D15971

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

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=257203&r1=257202&r2=257203&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Fri Jan  8 14:11:47 2016
@@ -211,7 +211,6 @@ void InputSectionBase<ELFT>::relocate(ui
     uintX_t SymVA = getSymVA<ELFT>(*Body);
     if (Target->relocNeedsPlt(Type, *Body)) {
       SymVA = Out<ELFT>::Plt->getEntryAddr(*Body);
-      Type = Target->getPltRefReloc(Type);
     } else if (Target->relocNeedsGot(Type, *Body)) {
       SymVA = Out<ELFT>::Got->getEntryAddr(*Body);
       if (Body->isTls())

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=257203&r1=257202&r2=257203&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Fri Jan  8 14:11:47 2016
@@ -122,7 +122,6 @@ private:
 class X86_64TargetInfo final : public TargetInfo {
 public:
   X86_64TargetInfo();
-  unsigned getPltRefReloc(unsigned Type) const override;
   bool isTlsDynReloc(unsigned Type, const SymbolBody &S) const override;
   void writeGotPltHeaderEntries(uint8_t *Buf) const override;
   void writeGotPltEntry(uint8_t *Buf, uint64_t Plt) const override;
@@ -176,7 +175,6 @@ class AArch64TargetInfo final : public T
 public:
   AArch64TargetInfo();
   unsigned getDynReloc(unsigned Type) const override;
-  unsigned getPltRefReloc(unsigned Type) const override;
   void writeGotPltEntry(uint8_t *Buf, uint64_t Plt) const override;
   void writePltZeroEntry(uint8_t *Buf, uint64_t GotEntryAddr,
                          uint64_t PltEntryAddr) const override;
@@ -265,8 +263,6 @@ bool TargetInfo::needsCopyRel(uint32_t T
 
 bool TargetInfo::isGotRelative(uint32_t Type) const { return false; }
 
-unsigned TargetInfo::getPltRefReloc(unsigned Type) const { return PCRelReloc; }
-
 bool TargetInfo::isRelRelative(uint32_t Type) const { return true; }
 
 bool TargetInfo::isSizeReloc(uint32_t Type) const { return false; }
@@ -655,12 +651,6 @@ bool X86_64TargetInfo::isTlsDynReloc(uns
   return Type == R_X86_64_GOTTPOFF || Type == R_X86_64_TLSGD;
 }
 
-unsigned X86_64TargetInfo::getPltRefReloc(unsigned Type) const {
-  if (Type == R_X86_64_PLT32)
-    return R_X86_64_PC32;
-  return Type;
-}
-
 bool X86_64TargetInfo::relocNeedsPlt(uint32_t Type, const SymbolBody &S) const {
   if (needsCopyRel(Type, S))
     return false;
@@ -1151,8 +1141,6 @@ unsigned AArch64TargetInfo::getDynReloc(
                             "recompile with -fPIC.");
 }
 
-unsigned AArch64TargetInfo::getPltRefReloc(unsigned Type) const { return Type; }
-
 void AArch64TargetInfo::writeGotPltEntry(uint8_t *Buf, uint64_t Plt) const {
   write64le(Buf, Out<ELF64LE>::Plt->getVA());
 }

Modified: lld/trunk/ELF/Target.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.h?rev=257203&r1=257202&r2=257203&view=diff
==============================================================================
--- lld/trunk/ELF/Target.h (original)
+++ lld/trunk/ELF/Target.h Fri Jan  8 14:11:47 2016
@@ -45,7 +45,6 @@ public:
   virtual bool isTlsDynReloc(unsigned Type, const SymbolBody &S) const {
     return false;
   }
-  virtual unsigned getPltRefReloc(unsigned Type) const;
   virtual unsigned getTlsGotReloc(unsigned Type = -1) const {
     return TlsGotReloc;
   }




More information about the llvm-commits mailing list