Skip to content

Commit d2f8b87

Browse files
xbjfkDorianNiemiecSVRJS
authored andcommitted
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. (backport <rust-lang#4443>) (cherry picked from commit 85a7c85)
1 parent 15b760d commit d2f8b87

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
@@ -3730,6 +3730,9 @@ fn test_linux(target: &str) {
37303730
let wasm32 = target.contains("wasm32");
37313731
let uclibc = target.contains("uclibc");
37323732

3733+
let musl_v1_2_3 = env::var("RUST_LIBC_UNSTABLE_MUSL_V1_2_3").is_ok();
3734+
let old_musl = musl && !musl_v1_2_3;
3735+
37333736
let mut cfg = ctest_cfg();
37343737
cfg.define("_GNU_SOURCE", None);
37353738
// This macro re-defines fscanf,scanf,sscanf to link to the symbols that are
@@ -4300,9 +4303,9 @@ fn test_linux(target: &str) {
43004303
if name == "PR_GET_MDWE" || name == "PR_MDWE_NO_INHERIT" || name == "PR_MDWE_REFUSE_EXEC_GAIN" || name == "PR_SET_MDWE" {
43014304
return true;
43024305
}
4303-
// FIXME(musl): Requires musl >= 1.2
4304-
if name == "SO_PREFER_BUSY_POLL"
4305-
|| name == "SO_BUSY_POLL_BUDGET"
4306+
// Requires musl >= 1.2
4307+
if old_musl && (name == "SO_PREFER_BUSY_POLL"
4308+
|| name == "SO_BUSY_POLL_BUDGET")
43064309
{
43074310
return true;
43084311
}
@@ -4734,18 +4737,18 @@ fn test_linux(target: &str) {
47344737
"getnameinfo" if uclibc => true,
47354738

47364739
// FIXME(musl): This needs musl 1.2.2 or later.
4737-
"gettid" if musl => true,
4740+
"gettid" if old_musl => true,
47384741

47394742
// Needs glibc 2.33 or later.
47404743
"mallinfo2" => true,
47414744

4742-
"reallocarray" if musl => true,
4745+
"reallocarray" if old_musl => true,
47434746

47444747
// Not defined in uclibc as of 1.0.34
47454748
"gettid" if uclibc => true,
47464749

47474750
// Needs musl 1.2.3 or later.
4748-
"pthread_getname_np" if musl => true,
4751+
"pthread_getname_np" if old_musl => true,
47494752

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

0 commit comments

Comments
 (0)