diff options
Diffstat (limited to 'wasm/LTO.cpp')
-rw-r--r-- | wasm/LTO.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/wasm/LTO.cpp b/wasm/LTO.cpp index f15551da8b80e..96a947e29d412 100644 --- a/wasm/LTO.cpp +++ b/wasm/LTO.cpp @@ -36,8 +36,6 @@ #include <vector> using namespace llvm; -using namespace llvm::object; - using namespace lld; using namespace lld::wasm; @@ -55,6 +53,14 @@ static std::unique_ptr<lto::LTO> createLTO() { C.DisableVerify = Config->DisableVerify; C.DiagHandler = diagnosticHandler; C.OptLevel = Config->LTOO; + C.MAttrs = GetMAttrs(); + + if (Config->Relocatable) + C.RelocModel = None; + else if (Config->Pic) + C.RelocModel = Reloc::PIC_; + else + C.RelocModel = Reloc::Static; if (Config->SaveTemps) checkError(C.addSaveTemps(Config->OutputFile.str() + ".", @@ -72,10 +78,11 @@ BitcodeCompiler::BitcodeCompiler() : LTOObj(createLTO()) {} BitcodeCompiler::~BitcodeCompiler() = default; static void undefine(Symbol *S) { - if (isa<DefinedFunction>(S)) - replaceSymbol<UndefinedFunction>(S, S->getName(), 0); + if (auto F = dyn_cast<DefinedFunction>(S)) + replaceSymbol<UndefinedFunction>(F, F->getName(), 0, F->getFile(), + F->Signature); else if (isa<DefinedData>(S)) - replaceSymbol<UndefinedData>(S, S->getName(), 0); + replaceSymbol<UndefinedData>(S, S->getName(), 0, S->getFile()); else llvm_unreachable("unexpected symbol kind"); } |