mirror of https://github.com/rust-lang/rust.git
Add wasm_syscall feature to build system
This commit is contained in:
parent
36695a37c5
commit
0e6601f630
|
@ -312,6 +312,11 @@
|
||||||
# bootstrap)
|
# bootstrap)
|
||||||
#codegen-backends = ["llvm"]
|
#codegen-backends = ["llvm"]
|
||||||
|
|
||||||
|
# Flag indicating whether `libstd` calls an imported function to hande basic IO
|
||||||
|
# when targetting WebAssembly. Enable this to debug tests for the `wasm32-unknown-unknown`
|
||||||
|
# target, as without this option the test output will not be captured.
|
||||||
|
#wasm-syscall = false
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# Options for specific targets
|
# Options for specific targets
|
||||||
#
|
#
|
||||||
|
|
|
@ -107,6 +107,7 @@ pub struct Config {
|
||||||
pub debug_jemalloc: bool,
|
pub debug_jemalloc: bool,
|
||||||
pub use_jemalloc: bool,
|
pub use_jemalloc: bool,
|
||||||
pub backtrace: bool, // support for RUST_BACKTRACE
|
pub backtrace: bool, // support for RUST_BACKTRACE
|
||||||
|
pub wasm_syscall: bool,
|
||||||
|
|
||||||
// misc
|
// misc
|
||||||
pub low_priority: bool,
|
pub low_priority: bool,
|
||||||
|
@ -282,6 +283,7 @@ struct Rust {
|
||||||
test_miri: Option<bool>,
|
test_miri: Option<bool>,
|
||||||
save_toolstates: Option<String>,
|
save_toolstates: Option<String>,
|
||||||
codegen_backends: Option<Vec<String>>,
|
codegen_backends: Option<Vec<String>>,
|
||||||
|
wasm_syscall: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// TOML representation of how each build target is configured.
|
/// TOML representation of how each build target is configured.
|
||||||
|
@ -463,6 +465,7 @@ impl Config {
|
||||||
set(&mut config.rust_dist_src, rust.dist_src);
|
set(&mut config.rust_dist_src, rust.dist_src);
|
||||||
set(&mut config.quiet_tests, rust.quiet_tests);
|
set(&mut config.quiet_tests, rust.quiet_tests);
|
||||||
set(&mut config.test_miri, rust.test_miri);
|
set(&mut config.test_miri, rust.test_miri);
|
||||||
|
set(&mut config.wasm_syscall, rust.wasm_syscall);
|
||||||
config.rustc_parallel_queries = rust.experimental_parallel_queries.unwrap_or(false);
|
config.rustc_parallel_queries = rust.experimental_parallel_queries.unwrap_or(false);
|
||||||
config.rustc_default_linker = rust.default_linker.clone();
|
config.rustc_default_linker = rust.default_linker.clone();
|
||||||
config.musl_root = rust.musl_root.clone().map(PathBuf::from);
|
config.musl_root = rust.musl_root.clone().map(PathBuf::from);
|
||||||
|
|
|
@ -423,6 +423,9 @@ impl Build {
|
||||||
if self.config.profiler {
|
if self.config.profiler {
|
||||||
features.push_str(" profiler");
|
features.push_str(" profiler");
|
||||||
}
|
}
|
||||||
|
if self.config.wasm_syscall {
|
||||||
|
features.push_str(" wasm_syscall");
|
||||||
|
}
|
||||||
features
|
features
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1286,6 +1286,14 @@ impl Step for Crate {
|
||||||
cargo.env(format!("CARGO_TARGET_{}_RUNNER", envify(&target)),
|
cargo.env(format!("CARGO_TARGET_{}_RUNNER", envify(&target)),
|
||||||
build.config.nodejs.as_ref().expect("nodejs not configured"));
|
build.config.nodejs.as_ref().expect("nodejs not configured"));
|
||||||
} else if target.starts_with("wasm32") {
|
} else if target.starts_with("wasm32") {
|
||||||
|
// Warn about running tests without the `wasm_syscall` feature enabled.
|
||||||
|
// The javascript shim implements the syscall interface so that test
|
||||||
|
// output can be correctly reported.
|
||||||
|
if !build.config.wasm_syscall {
|
||||||
|
println!("Libstd was built without `wasm_syscall` feature enabled: \
|
||||||
|
test output may not be visible.");
|
||||||
|
}
|
||||||
|
|
||||||
// On the wasm32-unknown-unknown target we're using LTO which is
|
// On the wasm32-unknown-unknown target we're using LTO which is
|
||||||
// incompatible with `-C prefer-dynamic`, so disable that here
|
// incompatible with `-C prefer-dynamic`, so disable that here
|
||||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||||
|
|
Loading…
Reference in New Issue