Skip to content

Commit 5beba22

Browse files
xbjfktgross35
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 <#4443>) (cherry picked from commit 2a68f7f)
1 parent ee4d183 commit 5beba22

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.
@@ -88,6 +89,13 @@ fn main() {
8889
_ => (),
8990
}
9091

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