about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-09-11 02:38:07 +0200
committerGitHub <noreply@github.com>2019-09-11 02:38:07 +0200
commit751aec8b475d8449b7dfb759ee0e9b45596933d9 (patch)
treef9e6b29fbf0768cae3259c36ab7ca8d7b5f877f4
parent34f38d9809745e265f52b1789063ce03c7f006ca (diff)
parentbb9d3bea30c354fecca5dae735bec62962fc5e4c (diff)
downloadrust-751aec8b475d8449b7dfb759ee0e9b45596933d9.tar.gz
rust-751aec8b475d8449b7dfb759ee0e9b45596933d9.zip
Rollup merge of #64188 - alexcrichton:wasi-cdylib, r=varkor
rustc: Allow the cdylib crate type with wasm32-wasi

The wasm32-wasi target respects configuration around `crt-static` in
general, but is defaulted to being static. This interacted badly with
code which validated the `cdylib` crate type for `wasm32-wasi`,
erroneously saying that the `cdylib` crate type wasn't supported on
`wasm32-wasi` by default. This commit sets the appropriate flag in
`wasm32_wasi`'s target specification to indicate that the `cdylib` crate
type is supported regardless of `crt-static`

Closes #64187
-rw-r--r--src/librustc_target/spec/wasm32_wasi.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/librustc_target/spec/wasm32_wasi.rs b/src/librustc_target/spec/wasm32_wasi.rs
index bb33493a773..86978c05b15 100644
--- a/src/librustc_target/spec/wasm32_wasi.rs
+++ b/src/librustc_target/spec/wasm32_wasi.rs
@@ -97,6 +97,10 @@ pub fn target() -> Result<Target, String> {
     options.crt_static_default = true;
     options.crt_static_respected = true;
 
+    // Allow `+crt-static` to create a "cdylib" output which is just a wasm file
+    // without a main function.
+    options.crt_static_allows_dylibs = true;
+
     Ok(Target {
         llvm_target: "wasm32-wasi".to_string(),
         target_endian: "little".to_string(),