authorgravatar for luuk@degram.devLuuk de Gram <luuk@degram.dev> 2023-01-01 15:48:00+01:00
committergravatar for luuk@degram.devLuuk de Gram <luuk@degram.dev> 2023-01-02 18:36:18+01:00
log86ed96d9336c06668a727893e41856b2e4fe3d23
treec9241c1b5e142628053331baf0b5961cd74bd122
parent3e32a189566b191f1cfe01e911fed941e3e38603
signaturelock-open Commit is signed but in an unrecognized format.

wasm-linker: check for undefined symbols

Unless the `--import-symbols` flag is set, in which case we don't check for any undefined data symbols.

1 files changed, 2 insertions(+), 0 deletions(-)

src/link/Wasm.zig+2
...@@ -805,6 +805,7 @@ fn validateFeatures(...@@ -805,6 +805,7 @@ fn validateFeatures(
805805
806fn checkUndefinedSymbols(wasm: *const Wasm) !void {806fn checkUndefinedSymbols(wasm: *const Wasm) !void {
807 if (wasm.base.options.output_mode == .Obj) return;807 if (wasm.base.options.output_mode == .Obj) return;
808 if (wasm.base.options.import_symbols) return;
808809
809 var found_undefined_symbols = false;810 var found_undefined_symbols = false;
810 for (wasm.undefs.values()) |undef| {811 for (wasm.undefs.values()) |undef| {
...@@ -2467,6 +2468,7 @@ fn linkWithZld(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) l...@@ -2467,6 +2468,7 @@ fn linkWithZld(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) l
2467 var enabled_features: [@typeInfo(types.Feature.Tag).Enum.fields.len]bool = undefined;2468 var enabled_features: [@typeInfo(types.Feature.Tag).Enum.fields.len]bool = undefined;
2468 try wasm.validateFeatures(&enabled_features, &emit_features_count);2469 try wasm.validateFeatures(&enabled_features, &emit_features_count);
2469 try wasm.resolveSymbolsInArchives();2470 try wasm.resolveSymbolsInArchives();
2471 try wasm.checkUndefinedSymbols();
24702472
2471 try wasm.setupStart();2473 try wasm.setupStart();
2472 try wasm.setupImports();2474 try wasm.setupImports();