Skip to content

Commit 8610adb

Browse files
committed
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
1 parent cc1b795 commit 8610adb

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

build.rs

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

2627
// Extra values to allow for check-cfg.
@@ -85,6 +86,12 @@ fn main() {
8586
_ => (),
8687
}
8788

89+
let musl_v1_2_3 = env::var("RUST_LIBC_UNSTABLE_MUSL_V1_2_3").is_ok();
90+
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_MUSL_V1_2_3");
91+
// loongarch64 and ohos have already updated
92+
if musl_v1_2_3 || target_os == "loongarch64" || target_env == "ohos" {
93+
set_cfg("musl_v1_2_3");
94+
}
8895
let linux_time_bits64 = env::var("RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64").is_ok();
8996
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64");
9097
if linux_time_bits64 {

libc-test/build.rs

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

36623662
let mut cfg = ctest_cfg();
3663+
if musl_v1_2_3 {
3664+
cfg.cfg("musl_v1_2_3", None);
3665+
}
36633666
cfg.define("_GNU_SOURCE", None);
36643667
// This macro re-defines fscanf,scanf,sscanf to link to the symbols that are
36653668
// deprecated since glibc >= 2.29. This allows Rust binaries to link against

0 commit comments

Comments
 (0)