diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-04-21 17:37:11 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-04-21 17:37:11 +0000 |
commit | e26b50e71a9e4f52ee02df240e47de6e86fb5135 (patch) | |
tree | 46979c253f519b8c7c4bf21de660e2d6d25f2a51 | |
parent | 48d72342ffd5fdbc1b247a97472a4446362e1771 (diff) | |
download | bcm5719-llvm-e26b50e71a9e4f52ee02df240e47de6e86fb5135.tar.gz bcm5719-llvm-e26b50e71a9e4f52ee02df240e47de6e86fb5135.zip |
Reduce templating. NFC.
llvm-svn: 267018
-rw-r--r-- | lld/ELF/Target.cpp | 19 | ||||
-rw-r--r-- | lld/ELF/Target.h | 1 | ||||
-rw-r--r-- | lld/ELF/Writer.cpp | 2 |
3 files changed, 5 insertions, 17 deletions
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp index bf66c51359d..81d1c66c1f0 100644 --- a/lld/ELF/Target.cpp +++ b/lld/ELF/Target.cpp @@ -222,18 +222,16 @@ uint64_t TargetInfo::getVAStart() const { return Config->Pic ? 0 : VAStart; } bool TargetInfo::needsCopyRelImpl(uint32_t Type) const { return false; } -template <typename ELFT> static bool mayNeedCopy(const SymbolBody &S) { +static bool mayNeedCopy(const SymbolBody &S) { if (Config->Shared) return false; - auto *SS = dyn_cast<SharedSymbol<ELFT>>(&S); - if (!SS) + if (!S.isShared()) return false; - return SS->isObject(); + return S.isObject(); } -template <class ELFT> bool TargetInfo::needsCopyRel(uint32_t Type, const SymbolBody &S) const { - return mayNeedCopy<ELFT>(S) && needsCopyRelImpl(Type); + return mayNeedCopy(S) && needsCopyRelImpl(Type); } bool TargetInfo::isHintRel(uint32_t Type) const { return false; } @@ -1699,14 +1697,5 @@ template uint32_t getMipsGpAddr<ELF32LE>(); template uint32_t getMipsGpAddr<ELF32BE>(); template uint64_t getMipsGpAddr<ELF64LE>(); template uint64_t getMipsGpAddr<ELF64BE>(); - -template bool TargetInfo::needsCopyRel<ELF32LE>(uint32_t, - const SymbolBody &) const; -template bool TargetInfo::needsCopyRel<ELF32BE>(uint32_t, - const SymbolBody &) const; -template bool TargetInfo::needsCopyRel<ELF64LE>(uint32_t, - const SymbolBody &) const; -template bool TargetInfo::needsCopyRel<ELF64BE>(uint32_t, - const SymbolBody &) const; } } diff --git a/lld/ELF/Target.h b/lld/ELF/Target.h index 04704928214..3f016b59b0d 100644 --- a/lld/ELF/Target.h +++ b/lld/ELF/Target.h @@ -62,7 +62,6 @@ public: virtual RelExpr getRelExpr(uint32_t Type, const SymbolBody &S) const = 0; virtual void relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const = 0; - template <class ELFT> bool needsCopyRel(uint32_t Type, const SymbolBody &S) const; virtual ~TargetInfo(); diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 13afd8027dd..135eb3ec1b4 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -558,7 +558,7 @@ void Writer<ELFT>::scanRelocs(InputSectionBase<ELFT> &C, ArrayRef<RelTy> Rels) { // in a read-only section, we need to create a copy relocation for the // symbol. if (auto *B = dyn_cast<SharedSymbol<ELFT>>(&Body)) { - if (IsAlloc && !IsWrite && Target->needsCopyRel<ELFT>(Type, *B)) { + if (IsAlloc && !IsWrite && Target->needsCopyRel(Type, *B)) { if (!B->needsCopy()) addCopyRelSymbol(B); C.Relocations.push_back({Expr, Type, Offset, Addend, &Body}); |