Move handling of -Cprefer-dynamic
into builder.rs
This logic is *super* old and can be tweaked and moved into `builder.rs`
This commit is contained in:
parent
b3f95f460f
commit
385470b8bb
4 changed files with 10 additions and 15 deletions
|
@ -89,13 +89,6 @@ fn main() {
|
||||||
cmd.arg("--sysroot").arg(&sysroot);
|
cmd.arg("--sysroot").arg(&sysroot);
|
||||||
}
|
}
|
||||||
|
|
||||||
// When we build Rust dylibs they're all intended for intermediate
|
|
||||||
// usage, so make sure we pass the -Cprefer-dynamic flag instead of
|
|
||||||
// linking all deps statically into the dylib.
|
|
||||||
if env::var_os("RUSTC_NO_PREFER_DYNAMIC").is_none() {
|
|
||||||
cmd.arg("-Cprefer-dynamic");
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we're compiling specifically the `panic_abort` crate then we pass
|
// If we're compiling specifically the `panic_abort` crate then we pass
|
||||||
// the `-C panic=abort` option. Note that we do not do this for any
|
// the `-C panic=abort` option. Note that we do not do this for any
|
||||||
// other crate intentionally as this is the only crate for now that we
|
// other crate intentionally as this is the only crate for now that we
|
||||||
|
|
|
@ -1227,6 +1227,16 @@ impl<'a> Builder<'a> {
|
||||||
|
|
||||||
self.ci_env.force_coloring_in_ci(&mut cargo);
|
self.ci_env.force_coloring_in_ci(&mut cargo);
|
||||||
|
|
||||||
|
// When we build Rust dylibs they're all intended for intermediate
|
||||||
|
// usage, so make sure we pass the -Cprefer-dynamic flag instead of
|
||||||
|
// linking all deps statically into the dylib.
|
||||||
|
match mode {
|
||||||
|
Mode::Std | Mode::Rustc | Mode::Codegen => {
|
||||||
|
rustflags.arg("-Cprefer-dynamic");
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
|
||||||
Cargo {
|
Cargo {
|
||||||
command: cargo,
|
command: cargo,
|
||||||
rustflags,
|
rustflags,
|
||||||
|
|
|
@ -1814,10 +1814,6 @@ impl Step for Crate {
|
||||||
.expect("nodejs not configured"),
|
.expect("nodejs not configured"),
|
||||||
);
|
);
|
||||||
} else if target.starts_with("wasm32") {
|
} else if target.starts_with("wasm32") {
|
||||||
// On the wasm32-unknown-unknown target we're using LTO which is
|
|
||||||
// incompatible with `-C prefer-dynamic`, so disable that here
|
|
||||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
|
||||||
|
|
||||||
let node = builder
|
let node = builder
|
||||||
.config
|
.config
|
||||||
.nodejs
|
.nodejs
|
||||||
|
|
|
@ -234,10 +234,6 @@ pub fn prepare_tool_cargo(
|
||||||
let dir = builder.src.join(path);
|
let dir = builder.src.join(path);
|
||||||
cargo.arg("--manifest-path").arg(dir.join("Cargo.toml"));
|
cargo.arg("--manifest-path").arg(dir.join("Cargo.toml"));
|
||||||
|
|
||||||
// We don't want to build tools dynamically as they'll be running across
|
|
||||||
// stages and such and it's just easier if they're not dynamically linked.
|
|
||||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
|
||||||
|
|
||||||
if source_type == SourceType::Submodule {
|
if source_type == SourceType::Submodule {
|
||||||
cargo.env("RUSTC_EXTERNAL_TOOL", "1");
|
cargo.env("RUSTC_EXTERNAL_TOOL", "1");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue