aboutsummaryrefslogtreecommitdiffstats
path: root/ELF/LTO.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ELF/LTO.cpp')
-rw-r--r--ELF/LTO.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/ELF/LTO.cpp b/ELF/LTO.cpp
index a3d6a141a202..b342b6195f1d 100644
--- a/ELF/LTO.cpp
+++ b/ELF/LTO.cpp
@@ -96,12 +96,12 @@ BitcodeCompiler::BitcodeCompiler() : LTOObj(createLTO()) {}
BitcodeCompiler::~BitcodeCompiler() = default;
-static void undefine(Symbol *S) {
- replaceBody<Undefined>(S, S->body()->getName(), /*IsLocal=*/false,
- STV_DEFAULT, S->body()->Type, nullptr);
+template <class ELFT> static void undefine(Symbol *S) {
+ replaceBody<Undefined<ELFT>>(S, S->body()->getName(), /*IsLocal=*/false,
+ STV_DEFAULT, S->body()->Type, nullptr);
}
-void BitcodeCompiler::add(BitcodeFile &F) {
+template <class ELFT> void BitcodeCompiler::add(BitcodeFile &F) {
lto::InputFile &Obj = *F.Obj;
unsigned SymNum = 0;
std::vector<Symbol *> Syms = F.getSymbols();
@@ -126,7 +126,7 @@ void BitcodeCompiler::add(BitcodeFile &F) {
R.VisibleToRegularObj =
Sym->IsUsedInRegularObj || (R.Prevailing && Sym->includeInDynsym());
if (R.Prevailing)
- undefine(Sym);
+ undefine<ELFT>(Sym);
}
checkError(LTOObj->add(std::move(F.Obj), Resols));
}
@@ -157,3 +157,8 @@ std::vector<InputFile *> BitcodeCompiler::compile() {
}
return Ret;
}
+
+template void BitcodeCompiler::template add<ELF32LE>(BitcodeFile &);
+template void BitcodeCompiler::template add<ELF32BE>(BitcodeFile &);
+template void BitcodeCompiler::template add<ELF64LE>(BitcodeFile &);
+template void BitcodeCompiler::template add<ELF64BE>(BitcodeFile &);