[lld] r259155 - Define stub functions instead of pure virtual functions.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 28 19:51:51 PST 2016


Author: ruiu
Date: Thu Jan 28 21:51:51 2016
New Revision: 259155

URL: http://llvm.org/viewvc/llvm-project?rev=259155&view=rev
Log:
Define stub functions instead of pure virtual functions.

To remove empty functions.

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

Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=259155&r1=259154&r2=259155&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Thu Jan 28 21:51:51 2016
@@ -153,11 +153,6 @@ private:
 class PPCTargetInfo final : public TargetInfo {
 public:
   PPCTargetInfo();
-  void writeGotPlt(uint8_t *Buf, uint64_t Plt) const override;
-  void writePltZero(uint8_t *Buf) const override;
-  void writePlt(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
-                uint64_t PltEntryAddr, int32_t Index,
-                unsigned RelOff) const override;
   bool needsGot(uint32_t Type, const SymbolBody &S) const override;
   bool needsPlt(uint32_t Type, const SymbolBody &S) const override;
   void relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type, uint64_t P,
@@ -169,8 +164,6 @@ public:
 class PPC64TargetInfo final : public TargetInfo {
 public:
   PPC64TargetInfo();
-  void writeGotPlt(uint8_t *Buf, uint64_t Plt) const override;
-  void writePltZero(uint8_t *Buf) const override;
   void writePlt(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
                 uint64_t PltEntryAddr, int32_t Index,
                 unsigned RelOff) const override;
@@ -204,11 +197,6 @@ public:
 class AMDGPUTargetInfo final : public TargetInfo {
 public:
   AMDGPUTargetInfo();
-  void writeGotPlt(uint8_t *Buf, uint64_t Plt) const override;
-  void writePltZero(uint8_t *Buf) const override;
-  void writePlt(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
-                uint64_t PltEntryAddr, int32_t Index,
-                unsigned RelOff) const override;
   bool needsGot(uint32_t Type, const SymbolBody &S) const override;
   bool needsPlt(uint32_t Type, const SymbolBody &S) const override;
   void relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type, uint64_t P,
@@ -221,11 +209,6 @@ public:
   MipsTargetInfo();
   unsigned getDynRel(unsigned Type) const override;
   void writeGotHeader(uint8_t *Buf) const override;
-  void writeGotPlt(uint8_t *Buf, uint64_t Plt) const override;
-  void writePltZero(uint8_t *Buf) const override;
-  void writePlt(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
-                uint64_t PltEntryAddr, int32_t Index,
-                unsigned RelOff) const override;
   bool needsGot(uint32_t Type, const SymbolBody &S) const override;
   bool needsPlt(uint32_t Type, const SymbolBody &S) const override;
   void relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type, uint64_t P,
@@ -289,10 +272,6 @@ unsigned TargetInfo::relaxTls(uint8_t *L
   return 0;
 }
 
-void TargetInfo::writeGotHeader(uint8_t *Buf) const {}
-
-void TargetInfo::writeGotPltHeader(uint8_t *Buf) const {}
-
 X86TargetInfo::X86TargetInfo() {
   CopyRel = R_386_COPY;
   GotRel = R_386_GLOB_DAT;
@@ -929,11 +908,6 @@ static uint16_t applyPPCHighest(uint64_t
 static uint16_t applyPPCHighesta(uint64_t V) { return (V + 0x8000) >> 48; }
 
 PPCTargetInfo::PPCTargetInfo() {}
-void PPCTargetInfo::writeGotPlt(uint8_t *Buf, uint64_t Plt) const {}
-void PPCTargetInfo::writePltZero(uint8_t *Buf) const {}
-void PPCTargetInfo::writePlt(uint8_t *Buf, uint64_t GotAddr,
-                             uint64_t GotEntryAddr, uint64_t PltEntryAddr,
-                             int32_t Index, unsigned RelOff) const {}
 bool PPCTargetInfo::needsGot(uint32_t Type, const SymbolBody &S) const {
   return false;
 }
@@ -994,8 +968,6 @@ uint64_t getPPC64TocBase() {
   return TocVA + 0x8000;
 }
 
-void PPC64TargetInfo::writeGotPlt(uint8_t *Buf, uint64_t Plt) const {}
-void PPC64TargetInfo::writePltZero(uint8_t *Buf) const {}
 void PPC64TargetInfo::writePlt(uint8_t *Buf, uint64_t GotAddr,
                                uint64_t GotEntryAddr, uint64_t PltEntryAddr,
                                int32_t Index, unsigned RelOff) const {
@@ -1404,20 +1376,6 @@ void AArch64TargetInfo::relocateOne(uint
 
 AMDGPUTargetInfo::AMDGPUTargetInfo() {}
 
-void AMDGPUTargetInfo::writeGotPlt(uint8_t *Buf, uint64_t Plt) const {
-  llvm_unreachable("not implemented");
-}
-
-void AMDGPUTargetInfo::writePltZero(uint8_t *Buf) const {
-  llvm_unreachable("not implemented");
-}
-
-void AMDGPUTargetInfo::writePlt(uint8_t *Buf, uint64_t GotAddr,
-                                uint64_t GotEntryAddr, uint64_t PltEntryAddr,
-                                int32_t Index, unsigned RelOff) const {
-  llvm_unreachable("not implemented");
-}
-
 bool AMDGPUTargetInfo::needsGot(uint32_t Type, const SymbolBody &S) const {
   return false;
 }
@@ -1460,16 +1418,6 @@ void MipsTargetInfo<ELFT>::writeGotHeade
 }
 
 template <class ELFT>
-void MipsTargetInfo<ELFT>::writeGotPlt(uint8_t *Buf, uint64_t Plt) const {}
-template <class ELFT>
-void MipsTargetInfo<ELFT>::writePltZero(uint8_t *Buf) const {}
-template <class ELFT>
-void MipsTargetInfo<ELFT>::writePlt(uint8_t *Buf, uint64_t GotAddr,
-                                    uint64_t GotEntryAddr,
-                                    uint64_t PltEntryAddr, int32_t Index,
-                                    unsigned RelOff) const {}
-
-template <class ELFT>
 bool MipsTargetInfo<ELFT>::needsGot(uint32_t Type, const SymbolBody &S) const {
   return Type == R_MIPS_GOT16 || Type == R_MIPS_CALL16;
 }

Modified: lld/trunk/ELF/Target.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.h?rev=259155&r1=259154&r2=259155&view=diff
==============================================================================
--- lld/trunk/ELF/Target.h (original)
+++ lld/trunk/ELF/Target.h Thu Jan 28 21:51:51 2016
@@ -39,18 +39,18 @@ public:
 
   virtual unsigned getTlsGotRel(unsigned Type = -1) const { return TlsGotRel; }
 
-  virtual void writeGotHeader(uint8_t *Buf) const;
-  virtual void writeGotPltHeader(uint8_t *Buf) const;
-  virtual void writeGotPlt(uint8_t *Buf, uint64_t Plt) const = 0;
+  virtual void writeGotHeader(uint8_t *Buf) const {}
+  virtual void writeGotPltHeader(uint8_t *Buf) const {}
+  virtual void writeGotPlt(uint8_t *Buf, uint64_t Plt) const {};
 
   // If lazy binding is supported, the first entry of the PLT has code
   // to call the dynamic linker to resolve PLT entries the first time
   // they are called. This function writes that code.
-  virtual void writePltZero(uint8_t *Buf) const = 0;
+  virtual void writePltZero(uint8_t *Buf) const {}
 
   virtual void writePlt(uint8_t *Buf, uint64_t GotAddr, uint64_t GotEntryAddr,
                         uint64_t PltEntryAddr, int32_t Index,
-                        unsigned RelOff) const = 0;
+                        unsigned RelOff) const {}
 
   // Returns true if a relocation is just a hint for linker to make for example
   // some code optimization. Such relocations should not be handled as a regular




More information about the llvm-commits mailing list