Skip to content

Commit ae052d3

Browse files
authored
Merge pull request #4111 from tgross35/backport-bell-pepper
[0.2] Backports
2 parents abfe64f + 43fe4a0 commit ae052d3

28 files changed

+118
-87
lines changed

.github/workflows/full_ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ jobs:
165165
- i686-linux-android
166166
- i686-unknown-linux-musl
167167
- loongarch64-unknown-linux-gnu
168+
- loongarch64-unknown-linux-musl
168169
- powerpc-unknown-linux-gnu
169170
- powerpc64-unknown-linux-gnu
170171
- powerpc64le-unknown-linux-gnu

ci/android-install-ndk.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env sh
22

3-
set -ex
3+
set -eux
44

55
ndk=android-ndk-r27
66
wget --tries=20 -q "https://dl.google.com/android/repository/${ndk}-linux.zip"

ci/android-install-sdk.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env sh
22

3-
set -ex
3+
set -eux
44

55
# Prep the SDK and emulator
66
#

ci/android-sysimage.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -ex
3+
set -eux
44

55
URL=https://dl.google.com/android/repository/sys-img/android
66

ci/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# The FILTER environment variable can be used to select which target(s) to build.
66
# For example: set FILTER to vxworks to select the targets that has vxworks in name
77

8-
set -ex
8+
set -eux
99

1010
: "${TOOLCHAIN?The TOOLCHAIN environment variable must be set.}"
1111
: "${OS?The OS environment variable must be set.}"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM ubuntu:24.04
2+
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
4+
ca-certificates curl gcc git libc6-dev make qemu-user xz-utils
5+
6+
COPY install-musl-cross.sh /
7+
RUN sh /install-musl-cross.sh loongarch64-unknown-linux-musl
8+
9+
ENV CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_LINKER=loongarch64-unknown-linux-musl-gcc \
10+
CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_RUNNER="qemu-loongarch64" \
11+
CC_loongarch64_unknown_linux_musl=loongarch64-unknown-linux-musl-gcc \
12+
CFLAGS_loongarch64_unknown_linux_musl="-mabi=lp64d -fPIC" \
13+
QEMU_LD_PREFIX=/loongarch64-unknown-linux-musl/loongarch64-unknown-linux-musl/sysroot \
14+
PATH=$PATH:/loongarch64-unknown-linux-musl/bin:/rust/bin

ci/docker/wasm32-unknown-emscripten/node-wrapper.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
set -e
3+
set -eux
44

55
me="$1"
66
shift

ci/emscripten-entry.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -ex
3+
set -eux
44

55
# shellcheck disable=SC1091
66
source /emsdk-portable/emsdk_env.sh &> /dev/null

ci/emscripten.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -ex
3+
set -eux
44

55
# Note: keep in sync with:
66
# https://github.com/rust-lang/rust/blob/master/src/ci/docker/scripts/emscripten.sh

ci/install-musl-cross.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
#
3+
# Install musl cross toolchain
4+
5+
set -ex
6+
7+
MUSL_CROSS_VER=20241103
8+
MUSL_CROSS_URL=https://github.com/musl-cross/musl-cross/releases/download/$MUSL_CROSS_VER/$1.tar.xz
9+
10+
curl -L --retry 5 "$MUSL_CROSS_URL" | tar -xJf - -C /

ci/install-musl.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Install musl and musl-sanitized linux kernel headers
44
# to musl-{$1} directory
55

6-
set -ex
6+
set -eux
77

88
musl_version=1.1.24
99
musl="musl-${musl_version}"

ci/install-rust.sh

+10-13
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
#!/usr/bin/env sh
22
# This is intended to be used in CI only.
33

4-
set -ex
4+
set -eux
55

66
echo "Setup toolchain"
7-
toolchain=
8-
if [ -n "$TOOLCHAIN" ]; then
9-
toolchain=$TOOLCHAIN
10-
else
11-
toolchain=nightly
12-
fi
137

14-
if [ "$OS" = "windows" ]; then
8+
toolchain="${TOOLCHAIN:-nightly}"
9+
os="${OS:-}"
10+
11+
if [ "$os" = "windows" ]; then
1512
: "${TARGET?The TARGET environment variable must be set.}"
1613
rustup set profile minimal
1714
rustup update --force "$toolchain-$TARGET"
@@ -22,18 +19,18 @@ else
2219
rustup default "$toolchain"
2320
fi
2421

25-
if [ -n "$TARGET" ]; then
22+
if [ -n "${TARGET:-}" ]; then
2623
echo "Install target"
2724
rustup target add "$TARGET"
2825
fi
2926

30-
if [ -n "$INSTALL_RUST_SRC" ]; then
27+
if [ -n "${INSTALL_RUST_SRC:-}" ]; then
3128
echo "Install rust-src"
3229
rustup component add rust-src
3330
fi
3431

35-
if [ "$OS" = "windows" ]; then
36-
if [ "$ARCH_BITS" = "i686" ]; then
32+
if [ "$os" = "windows" ]; then
33+
if [ "${ARCH_BITS:-}" = "i686" ]; then
3734
echo "Install MinGW32"
3835
choco install mingw --x86 --force
3936
fi
@@ -44,7 +41,7 @@ if [ "$OS" = "windows" ]; then
4441
/usr/bin/find "C:\ProgramData\Chocolatey" -name "dllcrt2*"
4542
/usr/bin/find "C:\ProgramData\Chocolatey" -name "libmsvcrt*"
4643

47-
if [ -n "$ARCH_BITS" ]; then
44+
if [ -n "${ARCH_BITS:-}" ]; then
4845
echo "Fix MinGW"
4946
for i in crt2.o dllcrt2.o libmingwex.a libmsvcrt.a ; do
5047
cp -f "/C/ProgramData/Chocolatey/lib/mingw/tools/install/mingw$ARCH_BITS/$ARCH-w64-mingw32/lib/$i" "$(rustc --print sysroot)/lib/rustlib/$TARGET/lib"

ci/linux-s390x.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env sh
22

3-
set -ex
3+
set -eux
44

55
mkdir -m 777 /qemu
66
cd /qemu

ci/linux-sparc64.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env sh
22

3-
set -ex
3+
set -eux
44

55
mkdir -m 777 /qemu
66
cd /qemu

ci/run-docker.sh

+9-9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Small script to run tests for a target (or all targets) inside all the
77
# respective docker images.
88

9-
set -ex
9+
set -eux
1010

1111
# Default to assuming the CARGO_HOME is one directory up (to account for a `bin`
1212
# subdir) from where the `cargo` binary in `$PATH` lives.
@@ -89,13 +89,13 @@ build_switch() {
8989
}
9090

9191
if [ -z "${1}" ]; then
92-
for d in ci/docker/*; do
93-
run "${d}"
94-
done
92+
for d in ci/docker/*; do
93+
run "${d}"
94+
done
9595
else
96-
if [ "${1}" != "switch" ]; then
97-
run "${1}"
98-
else
99-
build_switch
100-
fi
96+
if [ "${1}" != "switch" ]; then
97+
run "${1}"
98+
else
99+
build_switch
100+
fi
101101
fi

ci/run.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Builds and runs tests for a particular target passed as an argument to this
44
# script.
55

6-
set -ex
6+
set -eux
77

88
mirrors_url="https://ci-mirrors.rust-lang.org/libc"
99

@@ -15,7 +15,7 @@ target="$1"
1515
#
1616
# It's assume that all images, when run with two disks, will run the `run.sh`
1717
# script from the second which we place inside.
18-
if [ "$QEMU" != "" ]; then
18+
if [ -n "${QEMU:-}" ]; then
1919
tmpdir=/tmp/qemu-img-creation
2020
mkdir -p "${tmpdir}"
2121

ci/style.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
set -ex
3+
set -eux
44

55
if [ -n "${CI:-}" ]; then
66
rustup toolchain install nightly -c rustfmt --allow-downgrade

ci/test-runner-linux

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
set -e
3+
set -eux
44

55
arch="$1"
66
prog="$2"

ci/wasi.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -ex
3+
set -eux
44

55
apt-get update
66
apt-get install -y --no-install-recommends \

libc-test/build.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,10 @@ fn test_openbsd(target: &str) {
580580
// Good chance it's going to be wrong depending on the host release
581581
"KERN_MAXID" | "NET_RT_MAXID" => true,
582582
"EV_SYSFLAGS" => true,
583+
584+
// Removed in OpenBSD 7.7 (unused since 1991)
585+
"ATF_COM" | "ATF_PERM" | "ATF_PUBL" | "ATF_USETRAILERS" => true,
586+
583587
_ => false,
584588
}
585589
});
@@ -4551,14 +4555,14 @@ fn test_linux(target: &str) {
45514555
(struct_ == "iw_encode_ext" && field == "key") ||
45524556
// the `tcpi_snd_rcv_wscale` map two bitfield fields stored in a u8
45534557
(struct_ == "tcp_info" && field == "tcpi_snd_rcv_wscale") ||
4554-
// the `tcpi_delivery_rate_app_limited` field is a bitfield on musl
4555-
(musl && struct_ == "tcp_info" && field == "tcpi_delivery_rate_app_limited") ||
4556-
// the `tcpi_fast_open_client_fail` field is a bitfield on musl
4557-
(musl && struct_ == "tcp_info" && field == "tcpi_fast_open_client_fail") ||
4558+
// the `tcpi_delivery_fastopen_bitfields` map two bitfield fields stored in a u8
4559+
(musl && struct_ == "tcp_info" && field == "tcpi_delivery_fastopen_bitfields") ||
45584560
// either fsid_t or int[2] type
45594561
(struct_ == "fanotify_event_info_fid" && field == "fsid") ||
45604562
// `handle` is a VLA
4561-
(struct_ == "fanotify_event_info_fid" && field == "handle")
4563+
(struct_ == "fanotify_event_info_fid" && field == "handle") ||
4564+
// invalid application of 'sizeof' to incomplete type 'long unsigned int[]'
4565+
(musl && struct_ == "mcontext_t" && field == "__extcontext" && loongarch64)
45624566
});
45634567

45644568
cfg.skip_roundtrip(move |s| match s {
+15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
1+
KEYCTL_CAPABILITIES
2+
KEYCTL_CAPS0_BIG_KEY
3+
KEYCTL_CAPS0_CAPABILITIES
4+
KEYCTL_CAPS0_DIFFIE_HELLMAN
5+
KEYCTL_CAPS0_INVALIDATE
6+
KEYCTL_CAPS0_MOVE
7+
KEYCTL_CAPS0_PERSISTENT_KEYRINGS
8+
KEYCTL_CAPS0_PUBLIC_KEY
9+
KEYCTL_CAPS0_RESTRICT_KEYRING
10+
KEYCTL_CAPS1_NS_KEYRING_NAME
11+
KEYCTL_CAPS1_NS_KEY_TAG
12+
KEYCTL_MOVE
13+
MADV_SOFT_OFFLINE
114
PTRACE_GETFPREGS
215
PTRACE_GETFPXREGS
316
PTRACE_GETREGS
417
PTRACE_SETFPREGS
518
PTRACE_SETFPXREGS
619
PTRACE_SETREGS
20+
PTRACE_SYSEMU
21+
PTRACE_SYSEMU_SINGLESTEP

libc-test/semver/linux-loongarch64.txt

-15
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,11 @@ BPF_XOR
4040
CIBAUD
4141
FICLONE
4242
FICLONERANGE
43-
KEYCTL_CAPABILITIES
44-
KEYCTL_CAPS0_BIG_KEY
45-
KEYCTL_CAPS0_CAPABILITIES
46-
KEYCTL_CAPS0_DIFFIE_HELLMAN
47-
KEYCTL_CAPS0_INVALIDATE
48-
KEYCTL_CAPS0_MOVE
49-
KEYCTL_CAPS0_PERSISTENT_KEYRINGS
50-
KEYCTL_CAPS0_PUBLIC_KEY
51-
KEYCTL_CAPS0_RESTRICT_KEYRING
52-
KEYCTL_CAPS1_NS_KEYRING_NAME
53-
KEYCTL_CAPS1_NS_KEY_TAG
54-
KEYCTL_MOVE
55-
MADV_SOFT_OFFLINE
5643
MAP_SYNC
5744
NFT_MSG_DELOBJ
5845
NFT_MSG_GETOBJ
5946
NFT_MSG_GETOBJ_RESET
6047
NFT_MSG_NEWOBJ
61-
PTRACE_SYSEMU
62-
PTRACE_SYSEMU_SINGLESTEP
6348
SCM_TIMESTAMPNS
6449
SCM_WIFI_STATUS
6550
SIGSTKFLT

libc-test/semver/solarish.txt

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ LIO_WAIT
1616
LIO_WRITE
1717
PIPE_BUF
1818
SIGEV_PORT
19+
_POSIX_VDISABLE
1920
aio_cancel
2021
aio_error
2122
aio_fsync

src/unix/hurd/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,7 @@ s! {
874874
pub release: [::c_char; _UTSNAME_LENGTH],
875875
pub version: [::c_char; _UTSNAME_LENGTH],
876876
pub machine: [::c_char; _UTSNAME_LENGTH],
877+
pub domainname: [::c_char; _UTSNAME_LENGTH],
877878
}
878879

879880
pub struct rlimit64 {

src/unix/linux_like/linux/arch/generic/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,10 @@ cfg_if! {
353353
pub const RLIMIT_RTPRIO: ::c_int = 14;
354354
pub const RLIMIT_RTTIME: ::c_int = 15;
355355
#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
356+
#[cfg(not(target_arch = "loongarch64"))]
356357
pub const RLIM_NLIMITS: ::c_int = 15;
358+
#[cfg(target_arch = "loongarch64")]
359+
pub const RLIM_NLIMITS: ::c_int = 16;
357360
#[allow(deprecated)]
358361
#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
359362
pub const RLIMIT_NLIMITS: ::c_int = RLIM_NLIMITS;

0 commit comments

Comments
 (0)