Skip to content

Commit 72d6ea5

Browse files
committed
libc-test: update conditions for workarounds for musl <1.2.3
This commit gates various workarounds of older musl versions behind the RUST_LIBC_UNSTABLE_MUSL_V1_2_3 variable.
1 parent 793bb72 commit 72d6ea5

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

libc-test/build.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3656,6 +3656,9 @@ fn test_linux(target: &str) {
36563656
let wasm32 = target.contains("wasm32");
36573657
let uclibc = target.contains("uclibc");
36583658

3659+
let musl_v1_2_3 = env::var("RUST_LIBC_UNSTABLE_MUSL_V1_2_3").is_ok();
3660+
let old_musl = musl && !musl_v1_2_3;
3661+
36593662
let mut cfg = ctest_cfg();
36603663
cfg.define("_GNU_SOURCE", None);
36613664
// This macro re-defines fscanf,scanf,sscanf to link to the symbols that are
@@ -4222,9 +4225,9 @@ fn test_linux(target: &str) {
42224225
if name == "PR_GET_MDWE" || name == "PR_MDWE_NO_INHERIT" || name == "PR_MDWE_REFUSE_EXEC_GAIN" || name == "PR_SET_MDWE" {
42234226
return true;
42244227
}
4225-
// FIXME(musl): Requires musl >= 1.2
4226-
if name == "SO_PREFER_BUSY_POLL"
4227-
|| name == "SO_BUSY_POLL_BUDGET"
4228+
// Requires musl >= 1.2
4229+
if old_musl && (name == "SO_PREFER_BUSY_POLL"
4230+
|| name == "SO_BUSY_POLL_BUDGET")
42284231
{
42294232
return true;
42304233
}
@@ -4648,18 +4651,18 @@ fn test_linux(target: &str) {
46484651
"getnameinfo" if uclibc => true,
46494652

46504653
// FIXME(musl): This needs musl 1.2.2 or later.
4651-
"gettid" if musl => true,
4654+
"gettid" if old_musl => true,
46524655

46534656
// Needs glibc 2.33 or later.
46544657
"mallinfo2" => true,
46554658

4656-
"reallocarray" if musl => true,
4659+
"reallocarray" if old_musl => true,
46574660

46584661
// Not defined in uclibc as of 1.0.34
46594662
"gettid" if uclibc => true,
46604663

46614664
// Needs musl 1.2.3 or later.
4662-
"pthread_getname_np" if musl => true,
4665+
"pthread_getname_np" if old_musl => true,
46634666

46644667
// pthread_sigqueue uses sigval, which was initially declared
46654668
// as a struct but should be defined as a union. However due

0 commit comments

Comments
 (0)