diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2021-05-21 09:04:16 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-21 09:04:16 +0200 |
| commit | 4b69bd61e41f1a49bb0b00ac00a7e499ab7974a7 (patch) | |
| tree | f2a7d43ea77e01d6010c2256b79801769680acec /src/link | |
| parent | 0267abfe9b14b07dcf98f06218416f4b8aaeda48 (diff) | |
| parent | b63c92f0b9ce7b3876c5f51e12a6ae249dfa4bac (diff) | |
| download | zig-4b69bd61e41f1a49bb0b00ac00a7e499ab7974a7.tar.gz zig-4b69bd61e41f1a49bb0b00ac00a7e499ab7974a7.zip | |
Merge pull request #8837 from ziglang/cc-wasm32-wasi
cc,wasi: ship WASI libc and autobuild it when needed
Diffstat (limited to 'src/link')
| -rw-r--r-- | src/link/Wasm.zig | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index 41b08b09d6..8e296b2b6a 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -573,6 +573,7 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void { null; const target = self.base.options.target; + const link_in_crt = self.base.options.link_libc and self.base.options.output_mode == .Exe; const id_symlink_basename = "lld.id"; @@ -695,6 +696,18 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void { full_out_path, }); + if (link_in_crt) { + // TODO work out if we want standard crt, a reactor or a command + try argv.append(try comp.get_libc_crt_file(arena, "crt.o.wasm")); + } + + if (!is_obj and self.base.options.link_libc) { + try argv.append(try comp.get_libc_crt_file(arena, switch (self.base.options.link_mode) { + .Static => "libc.a", + .Dynamic => unreachable, + })); + } + // Positional arguments to the linker such as object files. try argv.appendSlice(self.base.options.objects); |
