Skip to content

Commit ff27a33

Browse files
committed
Auto merge of #1588 - oxalica:upgrade-musl, r=gnzlbg
Upgrade to musl 1.1.24 in CI Required by #1577 Note that in musl 1.1.24, `struct sched_param` from `sched.h` has changed and some fields became reserved. So [these fields](https://github.com/rust-lang/libc/blob/13d4a5da2eafd82d3ebb2acb729d8b8c9148fb1f/src/unix/linux_like/mod.rs#L97) are outdated. I'm not sure if we should rename them, since they are in public API. I simply skip `struct sched_param` from the test now. Here's the diff between musl 1.1.23 and 1.1.24 ``` diff --git a/include/sched.h b/include/sched.h index 05d40b1e..7e470d3a 100644 --- a/include/sched.h +++ b/include/sched.h @@ -18,10 +18,12 @@ extern "C" { struct sched_param { int sched_priority; - int sched_ss_low_priority; - struct timespec sched_ss_repl_period; - struct timespec sched_ss_init_budget; - int sched_ss_max_repl; + int __reserved1; + struct { + time_t __reserved1; + long __reserved2; + } __reserved2[2]; + int __reserved3; }; ```
2 parents bd48043 + b14e947 commit ff27a33

File tree

5 files changed

+59
-34
lines changed

5 files changed

+59
-34
lines changed

ci/docker/mips-unknown-linux-musl/Dockerfile

+16-9
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,23 @@ FROM ubuntu:19.04
22

33
RUN apt-get update && apt-get install -y --no-install-recommends \
44
gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \
5-
bzip2
5+
xz-utils patch
66

77
RUN mkdir /toolchain
88

9-
# Note that this originally came from:
10-
# https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/OpenWrt-SDK-ar71xx-generic_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2
11-
RUN curl --retry 5 -L https://ci-mirrors.rust-lang.org/libc/OpenWrt-SDK-ar71xx-generic_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 | \
12-
tar xjf - -C /toolchain --strip-components=1
9+
# Linux kernel version: 4.14.151
10+
# See build_dir/target-mips_24kc_musl/linux-ar71xx_generic/linux-4.14.151
11+
# Musl version: 1.1.24
12+
# See staging_dir/toolchain-mips_24kc_gcc-7.4.0_musl/info.mk
13+
RUN curl --retry 5 -L https://downloads.openwrt.org/releases/19.07.0-rc1/targets/ar71xx/generic/openwrt-sdk-19.07.0-rc1-ar71xx-generic_gcc-7.4.0_musl.Linux-x86_64.tar.xz | \
14+
tar xJf - -C /toolchain --strip-components=1
1315

14-
ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15/bin \
15-
CC_mips_unknown_linux_musl=mips-openwrt-linux-gcc \
16-
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_LINKER=mips-openwrt-linux-gcc \
17-
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mips -L /toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15"
16+
# See https://lkml.org/lkml/2014/3/14/269
17+
COPY sysinfo_guard.patch /toolchain
18+
RUN patch /toolchain/staging_dir/toolchain-mips_24kc_gcc-7.4.0_musl/include/linux/kernel.h </toolchain/sysinfo_guard.patch
19+
20+
ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mips_24kc_gcc-7.4.0_musl/bin \
21+
STAGING_DIR=/toolchain/staging_dir \
22+
CC_mips_unknown_linux_musl=mips-openwrt-linux-musl-gcc \
23+
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_LINKER=mips-openwrt-linux-musl-gcc \
24+
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mips -L /toolchain/staging_dir/toolchain-mips_24kc_gcc-7.4.0_musl"
+17-10
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
FROM ubuntu:19.04
22

33
RUN apt-get update && apt-get install -y --no-install-recommends \
4-
gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \
5-
bzip2
4+
gcc libc6-dev qemu-user ca-certificates qemu-system-mipsel curl \
5+
xz-utils patch
66

77
RUN mkdir /toolchain
88

9-
# Note that this originally came from:
10-
# https://downloads.openwrt.org/snapshots/trunk/malta/generic/OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2
11-
RUN curl --retry 5 -L https://ci-mirrors.rust-lang.org/libc/OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 | \
12-
tar xjf - -C /toolchain --strip-components=2
9+
# Linux kernel version: 4.14.151
10+
# See build_dir/target-mipsel_mips32_musl/linux-brcm47xx_generic/linux-4.14.151
11+
# Musl version: 1.1.24
12+
# See staging_dir/toolchain-mipsel_mips32_gcc-7.4.0_musl/info.mk
13+
RUN curl --retry 5 -L https://downloads.openwrt.org/releases/19.07.0-rc1/targets/brcm47xx/generic/openwrt-sdk-19.07.0-rc1-brcm47xx-generic_gcc-7.4.0_musl.Linux-x86_64.tar.xz | \
14+
tar xJf - -C /toolchain --strip-components=1
1315

14-
ENV PATH=$PATH:/rust/bin:/toolchain/bin \
15-
CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
16-
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_LINKER=mipsel-openwrt-linux-gcc \
17-
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mipsel -L /toolchain"
16+
# See https://lkml.org/lkml/2014/3/14/269
17+
COPY sysinfo_guard.patch /toolchain
18+
RUN patch /toolchain/staging_dir/toolchain-mipsel_mips32_gcc-7.4.0_musl/include/linux/kernel.h </toolchain/sysinfo_guard.patch
19+
20+
ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mipsel_mips32_gcc-7.4.0_musl/bin \
21+
STAGING_DIR=/toolchain/staging_dir \
22+
CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-musl-gcc \
23+
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_LINKER=mipsel-openwrt-linux-musl-gcc \
24+
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mipsel -L /toolchain/staging_dir/toolchain-mipsel_mips32_gcc-7.4.0_musl"

ci/install-musl.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
set -ex
77

8-
MUSL_VERSION=1.1.22
8+
MUSL_VERSION=1.1.24
99
MUSL="musl-${MUSL_VERSION}"
1010

1111
# Download, configure, build, and install musl:

ci/sysinfo_guard.patch

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@@ -2,7 +2,9 @@
2+
#ifndef _LINUX_KERNEL_H
3+
#define _LINUX_KERNEL_H
4+
5+
+#ifdef __GLIBC__
6+
#include <linux/sysinfo.h>
7+
+#endif
8+
9+
/*
10+
* 'kernel.h' contains some often-used function prototypes etc

libc-test/build.rs

+15-14
Original file line numberDiff line numberDiff line change
@@ -2063,14 +2063,14 @@ fn test_linux(target: &str) {
20632063
let i686 = target.contains("i686");
20642064
let mips = target.contains("mips");
20652065
let mips32 = mips && !target.contains("64");
2066-
let mips32_musl = mips32 && musl;
20672066
let mips64 = mips && target.contains("64");
20682067
let ppc64 = target.contains("powerpc64");
20692068
let s390x = target.contains("s390x");
20702069
let sparc64 = target.contains("sparc64");
20712070
let x32 = target.contains("x32");
20722071
let x86_32 = target.contains("i686");
20732072
let x86_64 = target.contains("x86_64");
2073+
let aarch64_musl = target.contains("aarch64") && musl;
20742074

20752075
let mut cfg = ctest_cfg();
20762076
cfg.define("_GNU_SOURCE", None);
@@ -2134,8 +2134,7 @@ fn test_linux(target: &str) {
21342134
"sys/prctl.h",
21352135
"sys/ptrace.h",
21362136
"sys/quota.h",
2137-
// FIXME: the mips-musl CI build jobs use ancient musl 1.0.15:
2138-
[!mips32_musl]: "sys/random.h",
2137+
"sys/random.h",
21392138
"sys/reboot.h",
21402139
"sys/resource.h",
21412140
"sys/sem.h",
@@ -2189,8 +2188,7 @@ fn test_linux(target: &str) {
21892188
"linux/fs.h",
21902189
"linux/futex.h",
21912190
"linux/genetlink.h",
2192-
// FIXME: musl version 1.0.15 used by mips build jobs is ancient
2193-
[!mips32_musl]: "linux/if.h",
2191+
"linux/if.h",
21942192
"linux/if_addr.h",
21952193
"linux/if_alg.h",
21962194
"linux/if_ether.h",
@@ -2307,9 +2305,6 @@ fn test_linux(target: &str) {
23072305
// structs.
23082306
"termios2" => true,
23092307

2310-
// FIXME: musl version using by mips build jobs 1.0.15 is ancient:
2311-
"ifmap" | "ifreq" | "ifconf" if mips32_musl => true,
2312-
23132308
// FIXME: remove once Ubuntu 20.04 LTS is released, somewhere in 2020.
23142309
// ucontext_t added a new field as of glibc 2.28; our struct definition is
23152310
// conservative and omits the field, but that means the size doesn't match for newer
@@ -2353,7 +2348,7 @@ fn test_linux(target: &str) {
23532348
// Require Linux kernel 5.1:
23542349
"F_SEAL_FUTURE_WRITE" => true,
23552350

2356-
// The musl version 1.0.22 used in CI does not
2351+
// The musl version 1.1.24 used in CI does not
23572352
// contain these glibc constants yet:
23582353
| "RLIMIT_RTTIME" // should be in `resource.h`
23592354
| "TCP_COOKIE_TRANSACTIONS" // should be in the `netinet/tcp.h` header
@@ -2375,10 +2370,6 @@ fn test_linux(target: &str) {
23752370
// - these constants are used by the glibc implementation.
23762371
n if musl && n.contains("__SIZEOF_PTHREAD") => true,
23772372

2378-
// FIXME: musl version 1.0.15 used by mips build jobs is ancient
2379-
t if mips32_musl && t.starts_with("IFF") => true,
2380-
"MFD_HUGETLB" | "AF_XDP" | "PF_XDP" if mips32_musl => true,
2381-
23822373
_ => false,
23832374
}
23842375
});
@@ -2462,7 +2453,17 @@ fn test_linux(target: &str) {
24622453
field == "_pad2" ||
24632454
field == "ssi_syscall" ||
24642455
field == "ssi_call_addr" ||
2465-
field == "ssi_arch"))
2456+
field == "ssi_arch")) ||
2457+
// FIXME: After musl 1.1.24, it have only one field `sched_priority`,
2458+
// while other fields become reserved.
2459+
(struct_ == "sched_param" && [
2460+
"sched_ss_low_priority",
2461+
"sched_ss_repl_period",
2462+
"sched_ss_init_budget",
2463+
"sched_ss_max_repl",
2464+
].contains(&field) && musl) ||
2465+
// FIXME: After musl 1.1.24, the type becomes `int` instead of `unsigned short`.
2466+
(struct_ == "ipc_perm" && field == "__seq" && aarch64_musl)
24662467
});
24672468

24682469
cfg.skip_roundtrip(move |s| match s {

0 commit comments

Comments
 (0)