Skip to content

Commit

Permalink
Merge pull request #4426 from halide/srj-wasmlld
Browse files Browse the repository at this point in the history
Fix lld::wasm::link() call for trunk LLVM
  • Loading branch information
steven-johnson committed Dec 4, 2019
2 parents 6656f57 + 78dd627 commit acbdc37
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/WasmExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1238,12 +1238,21 @@ std::vector<char> compile_to_wasm(const Module &module, const std::string &fn_na
for (int i = 0; i < c; ++i)
lld_args[i] = lld_arg_strs[i].c_str();

#if LLVM_VERSION >= 100
std::string lld_errs_string;
llvm::raw_string_ostream lld_errs(lld_errs_string);

if (!lld::wasm::link(lld_args, /*CanExitEarly*/ false, llvm::outs(), lld_errs)) {
internal_error << "lld::wasm::link failed: (" << lld_errs.str() << ")\n";
}
#else
std::string lld_errs_string;
llvm::raw_string_ostream lld_errs(lld_errs_string);

if (!lld::wasm::link(lld_args, /*CanExitEarly*/ false, lld_errs)) {
internal_error << "lld::wasm::link failed: (" << lld_errs.str() << ")\n";
}
#endif

#if WASM_DEBUG_LEVEL
wasm_output.detach();
Expand Down

0 comments on commit acbdc37

Please sign in to comment.