Make needsPlt a plain function instead of a template.
llvm-svn: 264267
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp
index 464738b..d079570 100644
--- a/lld/ELF/Target.cpp
+++ b/lld/ELF/Target.cpp
@@ -300,10 +300,9 @@
bool TargetInfo::refersToGotEntry(uint32_t Type) const { return false; }
-template <class ELFT>
TargetInfo::PltNeed TargetInfo::needsPlt(uint32_t Type,
const SymbolBody &S) const {
- if (S.isGnuIfunc<ELFT>())
+ if (S.IsGnuIFunc)
return Plt_Explicit;
if (S.isPreemptible() && needsPltImpl(Type))
return Plt_Explicit;
@@ -329,9 +328,8 @@
// that points to the real function is a dedicated got entry used by the
// plt. That is identified by special relocation types (R_X86_64_JUMP_SLOT,
// R_386_JMP_SLOT, etc).
- if (auto *SS = dyn_cast<SharedSymbol<ELFT>>(&S))
- if (!Config->Pic && SS->Sym.getType() == STT_FUNC &&
- !refersToGotEntry(Type))
+ if (S.isShared())
+ if (!Config->Pic && S.IsFunc && !refersToGotEntry(Type))
return Plt_Implicit;
return Plt_No;
@@ -500,7 +498,7 @@
return Target->canRelaxTls(Type, &S) && S.isPreemptible();
if (Type == R_386_TLS_GOTIE || Type == R_386_TLS_IE)
return !canRelaxTls(Type, &S);
- return Type == R_386_GOT32 || needsPlt<ELF32LE>(Type, S);
+ return Type == R_386_GOT32 || needsPlt(Type, S);
}
bool X86TargetInfo::needsPltImpl(uint32_t Type) const {
@@ -757,7 +755,7 @@
return Target->canRelaxTls(Type, &S) && S.isPreemptible();
if (Type == R_X86_64_GOTTPOFF)
return !canRelaxTls(Type, &S);
- return refersToGotEntry(Type) || needsPlt<ELF64LE>(Type, S);
+ return refersToGotEntry(Type) || needsPlt(Type, S);
}
uint32_t X86_64TargetInfo::getTlsGotRel(uint32_t Type) const {
@@ -1061,7 +1059,7 @@
}
bool PPC64TargetInfo::needsGot(uint32_t Type, SymbolBody &S) const {
- if (needsPlt<ELF64BE>(Type, S))
+ if (needsPlt(Type, S))
return true;
switch (Type) {
@@ -1334,7 +1332,7 @@
case R_AARCH64_LD64_GOT_LO12_NC:
return true;
default:
- return needsPlt<ELF64LE>(Type, S);
+ return needsPlt(Type, S);
}
}
@@ -1675,7 +1673,7 @@
template <class ELFT>
bool MipsTargetInfo<ELFT>::needsGot(uint32_t Type, SymbolBody &S) const {
- return needsPlt<ELFT>(Type, S) || refersToGotEntry(Type);
+ return needsPlt(Type, S) || refersToGotEntry(Type);
}
template <class ELFT>
@@ -1830,14 +1828,5 @@
const SymbolBody &) const;
template bool TargetInfo::needsCopyRel<ELF64BE>(uint32_t,
const SymbolBody &) const;
-
-template TargetInfo::PltNeed
-TargetInfo::needsPlt<ELF32LE>(uint32_t, const SymbolBody &) const;
-template TargetInfo::PltNeed
-TargetInfo::needsPlt<ELF32BE>(uint32_t, const SymbolBody &) const;
-template TargetInfo::PltNeed
-TargetInfo::needsPlt<ELF64LE>(uint32_t, const SymbolBody &) const;
-template TargetInfo::PltNeed
-TargetInfo::needsPlt<ELF64BE>(uint32_t, const SymbolBody &) const;
}
}