aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2021-05-21 09:04:16 +0200
committerGitHub <noreply@github.com>2021-05-21 09:04:16 +0200
commit4b69bd61e41f1a49bb0b00ac00a7e499ab7974a7 (patch)
treef2a7d43ea77e01d6010c2256b79801769680acec /src/main.zig
parent0267abfe9b14b07dcf98f06218416f4b8aaeda48 (diff)
parentb63c92f0b9ce7b3876c5f51e12a6ae249dfa4bac (diff)
downloadzig-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/main.zig')
-rw-r--r--src/main.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig
index b388329508..86d017b3b7 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -1548,6 +1548,12 @@ fn buildOutputType(
link_libcpp = true;
}
+ if (cross_target.getCpuArch().isWasm() and output_mode == .Lib and link_mode == null) {
+ // If link_mode is unspecified, always link as dynamic library when targeting Wasm,
+ // so that wasm-ld is invoked rather than standard archiver.
+ link_mode = .Dynamic;
+ }
+
// Now that we have target info, we can find out if any of the system libraries
// are part of libc or libc++. We remove them from the list and communicate their
// existence via flags instead.