Skip to content

Commit 85a7c85

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 e7762a8 commit 85a7c85

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
@@ -4226,9 +4229,9 @@ fn test_linux(target: &str) {
42264229
if name == "PR_GET_MDWE" || name == "PR_MDWE_NO_INHERIT" || name == "PR_MDWE_REFUSE_EXEC_GAIN" || name == "PR_SET_MDWE" {
42274230
return true;
42284231
}
4229-
// FIXME(musl): Requires musl >= 1.2
4230-
if name == "SO_PREFER_BUSY_POLL"
4231-
|| name == "SO_BUSY_POLL_BUDGET"
4232+
// Requires musl >= 1.2
4233+
if old_musl && (name == "SO_PREFER_BUSY_POLL"
4234+
|| name == "SO_BUSY_POLL_BUDGET")
42324235
{
42334236
return true;
42344237
}
@@ -4657,18 +4660,18 @@ fn test_linux(target: &str) {
46574660
"getnameinfo" if uclibc => true,
46584661

46594662
// FIXME(musl): This needs musl 1.2.2 or later.
4660-
"gettid" if musl => true,
4663+
"gettid" if old_musl => true,
46614664

46624665
// Needs glibc 2.33 or later.
46634666
"mallinfo2" => true,
46644667

4665-
"reallocarray" if musl => true,
4668+
"reallocarray" if old_musl => true,
46664669

46674670
// Not defined in uclibc as of 1.0.34
46684671
"gettid" if uclibc => true,
46694672

46704673
// Needs musl 1.2.3 or later.
4671-
"pthread_getname_np" if musl => true,
4674+
"pthread_getname_np" if old_musl => true,
46724675

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

0 commit comments

Comments
 (0)