wasm: pass --export-dynamic to wasm-ld for WASI reactors. (#9605)

Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
This commit is contained in:
Takeshi Yoneda 2021-08-24 21:03:50 +09:00 committed by GitHub
parent 8a37fe2176
commit 5c79370e9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -765,12 +765,8 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void {
if (self.base.options.wasi_exec_model == .reactor) { if (self.base.options.wasi_exec_model == .reactor) {
// Reactor execution model does not have _start so lld doesn't look for it. // Reactor execution model does not have _start so lld doesn't look for it.
try argv.append("--no-entry"); try argv.append("--no-entry");
// Make sure "_initialize" is exported even if this is pure Zig WASI reactor // Make sure "_initialize" and other used-defined functions are exported if this is WASI reactor.
// where WASM_SYMBOL_EXPORTED flag in LLVM is not set on _initialize. try argv.append("--export-dynamic");
try argv.appendSlice(&[_][]const u8{
"--export",
"_initialize",
});
} }
} else { } else {
try argv.append("--no-entry"); // So lld doesn't look for _start. try argv.append("--no-entry"); // So lld doesn't look for _start.