From 86ed96d9336c06668a727893e41856b2e4fe3d23 Mon Sep 17 00:00:00 2001 From: Luuk de Gram Date: Sun, 1 Jan 2023 15:48:00 +0100 Subject: [PATCH] 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. --- src/link/Wasm.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index d3b80a350c..42cc2883e2 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -805,6 +805,7 @@ fn validateFeatures( fn checkUndefinedSymbols(wasm: *const Wasm) !void { if (wasm.base.options.output_mode == .Obj) return; + if (wasm.base.options.import_symbols) return; var found_undefined_symbols = false; for (wasm.undefs.values()) |undef| { @@ -2467,6 +2468,7 @@ fn linkWithZld(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) l var enabled_features: [@typeInfo(types.Feature.Tag).Enum.fields.len]bool = undefined; try wasm.validateFeatures(&enabled_features, &emit_features_count); try wasm.resolveSymbolsInArchives(); + try wasm.checkUndefinedSymbols(); try wasm.setupStart(); try wasm.setupImports();