| author | |
| committer | |
| log | 8403612adc67d6398b3664b20eb453475688bd46 |
| tree | 8af8c50adf7573adc255ea68e0c677e64f99035f |
| parent | 4bffe645c6e621cdda858f9eeb4436980fece25c |
| signature |
Force importing symbols to show the correct functions are being
imported from the host environment.2 files changed, 3 insertions(+), 1 deletions(-)
src/link/Wasm.zig+1-1| ... | @@ -3443,7 +3443,7 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) ! | ... | @@ -3443,7 +3443,7 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) ! |
| 3443 | try argv.append("--no-entry"); // So lld doesn't look for _start. | 3443 | try argv.append("--no-entry"); // So lld doesn't look for _start. |
| 3444 | } | 3444 | } |
| 3445 | if (wasm.base.options.import_symbols) { | 3445 | if (wasm.base.options.import_symbols) { |
| 3446 | try argv.appendSlice(&[_][]const u8{"--allow-undefined"}); | 3446 | try argv.append("--allow-undefined"); |
| 3447 | } | 3447 | } |
| 3448 | try argv.appendSlice(&[_][]const u8{ | 3448 | try argv.appendSlice(&[_][]const u8{ |
| 3449 | "-o", | 3449 | "-o", |
test/link/wasm/extern-mangle/build.zig+2| ... | @@ -10,6 +10,8 @@ pub fn build(b: *Builder) void { | ... | @@ -10,6 +10,8 @@ pub fn build(b: *Builder) void { |
| 10 | const lib = b.addSharedLibrary("lib", "lib.zig", .unversioned); | 10 | const lib = b.addSharedLibrary("lib", "lib.zig", .unversioned); |
| 11 | lib.setBuildMode(mode); | 11 | lib.setBuildMode(mode); |
| 12 | lib.setTarget(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }); | 12 | lib.setTarget(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }); |
| 13 | lib.import_symbols = true; // import `a` and `b` | ||
| 14 | lib.rdynamic = true; // export `foo` | ||
| 13 | lib.install(); | 15 | lib.install(); |
| 14 | 16 | ||
| 15 | const check_lib = lib.checkObject(.wasm); | 17 | const check_lib = lib.checkObject(.wasm); |