Commit 8403612adc

Luuk de Gram <luuk@degram.dev>
2022-12-28 16:36:46
test/link: update linker tests
Force importing symbols to show the correct functions are being imported from the host environment.
1 parent 4bffe64
Changed files (2)
src
test
link
wasm
extern-mangle
src/link/Wasm.zig
@@ -3443,7 +3443,7 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) !
             try argv.append("--no-entry"); // So lld doesn't look for _start.
         }
         if (wasm.base.options.import_symbols) {
-            try argv.appendSlice(&[_][]const u8{"--allow-undefined"});
+            try argv.append("--allow-undefined");
         }
         try argv.appendSlice(&[_][]const u8{
             "-o",
test/link/wasm/extern-mangle/build.zig
@@ -10,6 +10,8 @@ pub fn build(b: *Builder) void {
     const lib = b.addSharedLibrary("lib", "lib.zig", .unversioned);
     lib.setBuildMode(mode);
     lib.setTarget(.{ .cpu_arch = .wasm32, .os_tag = .freestanding });
+    lib.import_symbols = true; // import `a` and `b`
+    lib.rdynamic = true; // export `foo`
     lib.install();
 
     const check_lib = lib.checkObject(.wasm);