diff options
| author | Peter Smith <peter.smith@linaro.org> | 2017-01-04 09:45:45 +0000 |
|---|---|---|
| committer | Peter Smith <peter.smith@linaro.org> | 2017-01-04 09:45:45 +0000 |
| commit | 97c6d78f3e7582ce717b24063e765a4246ce6f79 (patch) | |
| tree | b2d7d4a2ca91e9c02771e2e4a7b51cbf2c22b9f4 /lld/ELF/LTO.cpp | |
| parent | 3c6ce733f5720b4e13eae85d9aa3ce87b2084f4a (diff) | |
| download | bcm5719-llvm-97c6d78f3e7582ce717b24063e765a4246ce6f79.tar.gz bcm5719-llvm-97c6d78f3e7582ce717b24063e765a4246ce6f79.zip | |
[ELF] Add support for thunks to undefined non-weak symbols
In a shared library an undefined symbol is implicitly imported. If the
symbol is called as a function a PLT entry is generated for it. When the
caller is a Thumb b.w a thunk to the PLT entry is needed as all PLT
entries are in ARM state.
This change allows undefined symbols to have thunks in the same way that
shared symbols may have thunks.
llvm-svn: 290951
Diffstat (limited to 'lld/ELF/LTO.cpp')
| -rw-r--r-- | lld/ELF/LTO.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp index a3d6a141a20..b342b6195f1 100644 --- a/lld/ELF/LTO.cpp +++ b/lld/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 &); |

