Skip to content

Commit bed5c8d

Browse files
xbjfkDorianNiemiecSVRJS
authored andcommitted
Add musl_v1_2_3 feature
This feature, controlled by the environment variable RUST_LIBC_UNSTABLE_MUSL_V1_2_3 will control whether breaking changes up to musl v1.2.3 will be reflected (backport <rust-lang#4443>) (cherry picked from commit 2a68f7f)
1 parent 0097686 commit bed5c8d

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

build.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const ALLOWED_CFGS: &[&str] = &[
2222
"libc_ctest",
2323
// Corresponds to `__USE_TIME_BITS64` in UAPI
2424
"linux_time_bits64",
25+
"musl_v1_2_3"
2526
];
2627

2728
// Extra values to allow for check-cfg.
@@ -89,6 +90,13 @@ fn main() {
8990
_ => (),
9091
}
9192

93+
let musl_v1_2_3 = env::var("RUST_LIBC_UNSTABLE_MUSL_V1_2_3").is_ok();
94+
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_MUSL_V1_2_3");
95+
// loongarch64 and ohos have already updated
96+
if musl_v1_2_3 || target_os == "loongarch64" || target_env == "ohos" {
97+
// FIXME(musl): enable time64 api as well
98+
set_cfg("musl_v1_2_3");
99+
}
92100
let linux_time_bits64 = env::var("RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64").is_ok();
93101
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64");
94102
if linux_time_bits64 {

libc-test/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3734,6 +3734,9 @@ fn test_linux(target: &str) {
37343734
let old_musl = musl && !musl_v1_2_3;
37353735

37363736
let mut cfg = ctest_cfg();
3737+
if musl_v1_2_3 {
3738+
cfg.cfg("musl_v1_2_3", None);
3739+
}
37373740
cfg.define("_GNU_SOURCE", None);
37383741
// This macro re-defines fscanf,scanf,sscanf to link to the symbols that are
37393742
// deprecated since glibc >= 2.29. This allows Rust binaries to link against

0 commit comments

Comments
 (0)