diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2025-01-11 17:50:17 -0800 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-01-15 15:11:36 -0800 |
| commit | fbdcb2289b3fed28792474579625a977feca0ed1 (patch) | |
| tree | 0d1a71aecb870f00948a211f8bee5412e68191ec /src | |
| parent | 0dd0ebb6e2b9030b30a4333b3e79b88500fa6aff (diff) | |
| download | zig-fbdcb2289b3fed28792474579625a977feca0ed1.tar.gz zig-fbdcb2289b3fed28792474579625a977feca0ed1.zip | |
wasm linker: don't pretend it's possible to export data symbols
Diffstat (limited to 'src')
| -rw-r--r-- | src/link/Wasm/Flush.zig | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/link/Wasm/Flush.zig b/src/link/Wasm/Flush.zig index 91c8adb98e..8b1797aafc 100644 --- a/src/link/Wasm/Flush.zig +++ b/src/link/Wasm/Flush.zig @@ -154,14 +154,15 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { if (nav_export.name.toOptional() == entry_name) wasm.entry_resolution = .fromIpNav(wasm, nav_export.nav_index); } else { - try wasm.global_exports.append(gpa, .{ - .name = nav_export.name, - .global_index = Wasm.GlobalIndex.fromIpNav(wasm, nav_export.nav_index).?, - }); + // This is a data export because Zcu currently has no way to + // export wasm globals. _ = f.missing_exports.swapRemove(nav_export.name); _ = f.data_imports.swapRemove(nav_export.name); - // `f.global_imports` is ignored because Zcu has no way to - // export wasm globals. + if (!is_obj) { + diags.addError("unable to export data symbol '{s}'; not emitting a relocatable", .{ + nav_export.name.slice(wasm), + }); + } } } |
