mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
wasm-linker: Fix symbol name on undefined symbol
When emitting errors for undefined symbols, rather than unconditionally always using the name from an import, we must verify it's a symbol type that could have such an import. e.g. undefined data symbols do not have a corresponding import. For this reason we must use the regular name.
This commit is contained in:
parent
2339b25fd4
commit
1072f82acb
@ -824,7 +824,9 @@ fn checkUndefinedSymbols(wasm: *const Wasm) !void {
|
||||
} else wasm.name;
|
||||
const import_name = if (undef.file) |file_index| name: {
|
||||
const obj = wasm.objects.items[file_index];
|
||||
const name_index = obj.findImport(symbol.tag.externalType(), symbol.index).name;
|
||||
const name_index = if (symbol.tag == .function) name_index: {
|
||||
break :name_index obj.findImport(symbol.tag.externalType(), symbol.index).name;
|
||||
} else symbol.name;
|
||||
break :name obj.string_table.get(name_index);
|
||||
} else wasm.string_table.get(wasm.imports.get(undef).?.name);
|
||||
log.err("could not resolve undefined symbol '{s}'", .{import_name});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user