-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #133386 - wesleywiser:update_musl_base_crt_default, r…
…=jieyouxu Update linux_musl base to dynamically link the crt by default However, don't change the behavior of any existing targets at this time. For targets that used the old default, explicitly set `crt_static_default = true`. This makes it easier for new targets to use the correct defaults while leaving the changing of individual targets to future PRs. Related to rust-lang/compiler-team#422
- Loading branch information
Showing
24 changed files
with
99 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
use run_make_support::{rustc, serde_json}; | ||
|
||
// Please do NOT add more targets to this list! | ||
// Per https://github.com/rust-lang/compiler-team/issues/422, | ||
// we should be trying to move these targets to dynamically link | ||
// musl libc by default. | ||
static LEGACY_STATIC_LINKING_TARGETS: &[&'static str] = &[ | ||
"aarch64-unknown-linux-musl", | ||
"arm-unknown-linux-musleabi", | ||
"arm-unknown-linux-musleabihf", | ||
"armv5te-unknown-linux-musleabi", | ||
"armv7-unknown-linux-musleabi", | ||
"armv7-unknown-linux-musleabihf", | ||
"i586-unknown-linux-musl", | ||
"i686-unknown-linux-musl", | ||
"mips64-unknown-linux-musl", | ||
"mips64-unknown-linux-muslabi64", | ||
"mips64el-unknown-linux-muslabi64", | ||
"powerpc-unknown-linux-musl", | ||
"powerpc-unknown-linux-muslspe", | ||
"powerpc64-unknown-linux-musl", | ||
"powerpc64le-unknown-linux-musl", | ||
"riscv32gc-unknown-linux-musl", | ||
"s390x-unknown-linux-musl", | ||
"thumbv7neon-unknown-linux-musleabihf", | ||
"x86_64-unknown-linux-musl", | ||
]; | ||
|
||
fn main() { | ||
let targets = rustc().print("target-list").run().stdout_utf8(); | ||
|
||
for target in targets.lines() { | ||
let abi = target.split('-').last().unwrap(); | ||
|
||
if !abi.starts_with("musl") { | ||
continue; | ||
} | ||
|
||
let target_spec_json = rustc() | ||
.print("target-spec-json") | ||
.target(target) | ||
.arg("-Zunstable-options") | ||
.run() | ||
.stdout_utf8(); | ||
|
||
let target_spec: serde_json::Value = | ||
serde_json::from_str(&target_spec_json).expect("failed to parse target-spec-json"); | ||
let default = &target_spec["crt-static-default"]; | ||
|
||
// If the value is `null`, then the default to dynamically link from | ||
// musl_base was not overriden. | ||
if default.is_null() { | ||
continue; | ||
} | ||
|
||
if default.as_bool().expect("wasn't a boolean") | ||
&& !LEGACY_STATIC_LINKING_TARGETS.contains(&target) | ||
{ | ||
panic!("{target} statically links musl libc when it should dynamically link it"); | ||
} | ||
} | ||
} |