[lld] r259157 - ELF: Provide default implemenatations for simple functions.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 28 20:05:09 PST 2016


Author: ruiu
Date: Thu Jan 28 22:05:09 2016
New Revision: 259157

URL: http://llvm.org/viewvc/llvm-project?rev=259157&view=rev
Log:
ELF: Provide default implemenatations for simple 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=259157&r1=259156&r2=259157&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Thu Jan 28 22:05:09 2016
@@ -153,8 +153,6 @@ private:
 class PPCTargetInfo final : public TargetInfo {
 public:
   PPCTargetInfo();
-  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,
                    uint64_t SA, uint64_t ZA = 0,
                    uint8_t *PairedLoc = nullptr) const override;
@@ -196,9 +194,7 @@ public:
 
 class AMDGPUTargetInfo final : public TargetInfo {
 public:
-  AMDGPUTargetInfo();
-  bool needsGot(uint32_t Type, const SymbolBody &S) const override;
-  bool needsPlt(uint32_t Type, const SymbolBody &S) const override;
+  AMDGPUTargetInfo() {}
   void relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type, uint64_t P,
                    uint64_t SA, uint64_t ZA = 0,
                    uint8_t *PairedLoc = nullptr) const override;
@@ -258,14 +254,31 @@ bool TargetInfo::needsCopyRel(uint32_t T
   return false;
 }
 
-bool TargetInfo::isGotRelative(uint32_t Type) const { return false; }
+bool TargetInfo::isTlsLocalDynamicRel(unsigned Type) const {
+  return Type == TlsLocalDynamicRel;
+}
 
-bool TargetInfo::isHintRel(uint32_t Type) const { return false; }
+bool TargetInfo::isTlsGlobalDynamicRel(unsigned Type) const {
+  return Type == TlsGlobalDynamicRel;
+}
 
-bool TargetInfo::isRelRelative(uint32_t Type) const { return true; }
+bool TargetInfo::isTlsDynRel(unsigned Type, const SymbolBody &S) const {
+  return false;
+}
 
+bool TargetInfo::isGotRelative(uint32_t Type) const { return false; }
+bool TargetInfo::isHintRel(uint32_t Type) const { return false; }
+bool TargetInfo::isRelRelative(uint32_t Type) const { return true; }
 bool TargetInfo::isSizeRel(uint32_t Type) const { return false; }
 
+bool TargetInfo::needsGot(uint32_t Type, const SymbolBody &S) const {
+  return false;
+}
+
+bool TargetInfo::needsPlt(uint32_t Type, const SymbolBody &S) const {
+  return false;
+}
+
 unsigned TargetInfo::relaxTls(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,
                               uint64_t P, uint64_t SA,
                               const SymbolBody *S) const {
@@ -908,12 +921,6 @@ static uint16_t applyPPCHighest(uint64_t
 static uint16_t applyPPCHighesta(uint64_t V) { return (V + 0x8000) >> 48; }
 
 PPCTargetInfo::PPCTargetInfo() {}
-bool PPCTargetInfo::needsGot(uint32_t Type, const SymbolBody &S) const {
-  return false;
-}
-bool PPCTargetInfo::needsPlt(uint32_t Type, const SymbolBody &S) const {
-  return false;
-}
 bool PPCTargetInfo::isRelRelative(uint32_t Type) const { return false; }
 
 void PPCTargetInfo::relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,
@@ -1374,16 +1381,6 @@ void AArch64TargetInfo::relocateOne(uint
   }
 }
 
-AMDGPUTargetInfo::AMDGPUTargetInfo() {}
-
-bool AMDGPUTargetInfo::needsGot(uint32_t Type, const SymbolBody &S) const {
-  return false;
-}
-
-bool AMDGPUTargetInfo::needsPlt(uint32_t Type, const SymbolBody &S) const {
-  return false;
-}
-
 // Implementing relocations for AMDGPU is low priority since most
 // programs don't use relocations now. Thus, this function is not
 // actually called (relocateOne is called for each relocation).

Modified: lld/trunk/ELF/Target.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.h?rev=259157&r1=259156&r2=259157&view=diff
==============================================================================
--- lld/trunk/ELF/Target.h (original)
+++ lld/trunk/ELF/Target.h Thu Jan 28 22:05:09 2016
@@ -22,23 +22,11 @@ class SymbolBody;
 class TargetInfo {
 public:
   uint64_t getVAStart() const;
-
-  bool isTlsLocalDynamicRel(unsigned Type) const {
-    return Type == TlsLocalDynamicRel;
-  }
-
-  bool isTlsGlobalDynamicRel(unsigned Type) const {
-    return Type == TlsGlobalDynamicRel;
-  }
-
+  bool isTlsLocalDynamicRel(unsigned Type) const;
+  bool isTlsGlobalDynamicRel(unsigned Type) const;
   virtual unsigned getDynRel(unsigned Type) const { return Type; }
-
-  virtual bool isTlsDynRel(unsigned Type, const SymbolBody &S) const {
-    return false;
-  }
-
+  virtual bool isTlsDynRel(unsigned Type, const SymbolBody &S) const;
   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 {};
@@ -66,8 +54,8 @@ public:
 
   virtual bool isSizeRel(uint32_t Type) const;
   virtual bool needsDynRelative(unsigned Type) const { return false; }
-  virtual bool needsGot(uint32_t Type, const SymbolBody &S) const = 0;
-  virtual bool needsPlt(uint32_t Type, const SymbolBody &S) const = 0;
+  virtual bool needsGot(uint32_t Type, const SymbolBody &S) const;
+  virtual bool needsPlt(uint32_t Type, const SymbolBody &S) const;
   virtual void relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,
                            uint64_t P, uint64_t SA, uint64_t ZA = 0,
                            uint8_t *PairedLoc = nullptr) const = 0;




More information about the llvm-commits mailing list