Skip to content

Commit

Permalink
Merge pull request #4111 from tgross35/backport-bell-pepper
Browse files Browse the repository at this point in the history
[0.2] Backports
  • Loading branch information
tgross35 authored Nov 19, 2024
2 parents abfe64f + 43fe4a0 commit ae052d3
Show file tree
Hide file tree
Showing 28 changed files with 118 additions and 87 deletions.
1 change: 1 addition & 0 deletions .github/workflows/full_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ jobs:
- i686-linux-android
- i686-unknown-linux-musl
- loongarch64-unknown-linux-gnu
- loongarch64-unknown-linux-musl
- powerpc-unknown-linux-gnu
- powerpc64-unknown-linux-gnu
- powerpc64le-unknown-linux-gnu
Expand Down
2 changes: 1 addition & 1 deletion ci/android-install-ndk.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

set -ex
set -eux

ndk=android-ndk-r27
wget --tries=20 -q "https://dl.google.com/android/repository/${ndk}-linux.zip"
Expand Down
2 changes: 1 addition & 1 deletion ci/android-install-sdk.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

set -ex
set -eux

# Prep the SDK and emulator
#
Expand Down
2 changes: 1 addition & 1 deletion ci/android-sysimage.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -ex
set -eux

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

Expand Down
2 changes: 1 addition & 1 deletion ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# The FILTER environment variable can be used to select which target(s) to build.
# For example: set FILTER to vxworks to select the targets that has vxworks in name

set -ex
set -eux

: "${TOOLCHAIN?The TOOLCHAIN environment variable must be set.}"
: "${OS?The OS environment variable must be set.}"
Expand Down
14 changes: 14 additions & 0 deletions ci/docker/loongarch64-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ubuntu:24.04

RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl gcc git libc6-dev make qemu-user xz-utils

COPY install-musl-cross.sh /
RUN sh /install-musl-cross.sh loongarch64-unknown-linux-musl

ENV CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_LINKER=loongarch64-unknown-linux-musl-gcc \
CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_RUNNER="qemu-loongarch64" \
CC_loongarch64_unknown_linux_musl=loongarch64-unknown-linux-musl-gcc \
CFLAGS_loongarch64_unknown_linux_musl="-mabi=lp64d -fPIC" \
QEMU_LD_PREFIX=/loongarch64-unknown-linux-musl/loongarch64-unknown-linux-musl/sysroot \
PATH=$PATH:/loongarch64-unknown-linux-musl/bin:/rust/bin
2 changes: 1 addition & 1 deletion ci/docker/wasm32-unknown-emscripten/node-wrapper.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

set -e
set -eux

me="$1"
shift
Expand Down
2 changes: 1 addition & 1 deletion ci/emscripten-entry.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -ex
set -eux

# shellcheck disable=SC1091
source /emsdk-portable/emsdk_env.sh &> /dev/null
Expand Down
2 changes: 1 addition & 1 deletion ci/emscripten.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -ex
set -eux

# Note: keep in sync with:
# https://github.com/rust-lang/rust/blob/master/src/ci/docker/scripts/emscripten.sh
Expand Down
10 changes: 10 additions & 0 deletions ci/install-musl-cross.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
#
# Install musl cross toolchain

set -ex

MUSL_CROSS_VER=20241103
MUSL_CROSS_URL=https://github.com/musl-cross/musl-cross/releases/download/$MUSL_CROSS_VER/$1.tar.xz

curl -L --retry 5 "$MUSL_CROSS_URL" | tar -xJf - -C /
2 changes: 1 addition & 1 deletion ci/install-musl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Install musl and musl-sanitized linux kernel headers
# to musl-{$1} directory

set -ex
set -eux

musl_version=1.1.24
musl="musl-${musl_version}"
Expand Down
23 changes: 10 additions & 13 deletions ci/install-rust.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
#!/usr/bin/env sh
# This is intended to be used in CI only.

set -ex
set -eux

echo "Setup toolchain"
toolchain=
if [ -n "$TOOLCHAIN" ]; then
toolchain=$TOOLCHAIN
else
toolchain=nightly
fi

if [ "$OS" = "windows" ]; then
toolchain="${TOOLCHAIN:-nightly}"
os="${OS:-}"

if [ "$os" = "windows" ]; then
: "${TARGET?The TARGET environment variable must be set.}"
rustup set profile minimal
rustup update --force "$toolchain-$TARGET"
Expand All @@ -22,18 +19,18 @@ else
rustup default "$toolchain"
fi

if [ -n "$TARGET" ]; then
if [ -n "${TARGET:-}" ]; then
echo "Install target"
rustup target add "$TARGET"
fi

if [ -n "$INSTALL_RUST_SRC" ]; then
if [ -n "${INSTALL_RUST_SRC:-}" ]; then
echo "Install rust-src"
rustup component add rust-src
fi

if [ "$OS" = "windows" ]; then
if [ "$ARCH_BITS" = "i686" ]; then
if [ "$os" = "windows" ]; then
if [ "${ARCH_BITS:-}" = "i686" ]; then
echo "Install MinGW32"
choco install mingw --x86 --force
fi
Expand All @@ -44,7 +41,7 @@ if [ "$OS" = "windows" ]; then
/usr/bin/find "C:\ProgramData\Chocolatey" -name "dllcrt2*"
/usr/bin/find "C:\ProgramData\Chocolatey" -name "libmsvcrt*"

if [ -n "$ARCH_BITS" ]; then
if [ -n "${ARCH_BITS:-}" ]; then
echo "Fix MinGW"
for i in crt2.o dllcrt2.o libmingwex.a libmsvcrt.a ; do
cp -f "/C/ProgramData/Chocolatey/lib/mingw/tools/install/mingw$ARCH_BITS/$ARCH-w64-mingw32/lib/$i" "$(rustc --print sysroot)/lib/rustlib/$TARGET/lib"
Expand Down
2 changes: 1 addition & 1 deletion ci/linux-s390x.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

set -ex
set -eux

mkdir -m 777 /qemu
cd /qemu
Expand Down
2 changes: 1 addition & 1 deletion ci/linux-sparc64.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

set -ex
set -eux

mkdir -m 777 /qemu
cd /qemu
Expand Down
18 changes: 9 additions & 9 deletions ci/run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Small script to run tests for a target (or all targets) inside all the
# respective docker images.

set -ex
set -eux

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

if [ -z "${1}" ]; then
for d in ci/docker/*; do
run "${d}"
done
for d in ci/docker/*; do
run "${d}"
done
else
if [ "${1}" != "switch" ]; then
run "${1}"
else
build_switch
fi
if [ "${1}" != "switch" ]; then
run "${1}"
else
build_switch
fi
fi
4 changes: 2 additions & 2 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Builds and runs tests for a particular target passed as an argument to this
# script.

set -ex
set -eux

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

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

Expand Down
2 changes: 1 addition & 1 deletion ci/style.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

set -ex
set -eux

if [ -n "${CI:-}" ]; then
rustup toolchain install nightly -c rustfmt --allow-downgrade
Expand Down
2 changes: 1 addition & 1 deletion ci/test-runner-linux
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

set -e
set -eux

arch="$1"
prog="$2"
Expand Down
2 changes: 1 addition & 1 deletion ci/wasi.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -ex
set -eux

apt-get update
apt-get install -y --no-install-recommends \
Expand Down
14 changes: 9 additions & 5 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,10 @@ fn test_openbsd(target: &str) {
// Good chance it's going to be wrong depending on the host release
"KERN_MAXID" | "NET_RT_MAXID" => true,
"EV_SYSFLAGS" => true,

// Removed in OpenBSD 7.7 (unused since 1991)
"ATF_COM" | "ATF_PERM" | "ATF_PUBL" | "ATF_USETRAILERS" => true,

_ => false,
}
});
Expand Down Expand Up @@ -4551,14 +4555,14 @@ fn test_linux(target: &str) {
(struct_ == "iw_encode_ext" && field == "key") ||
// the `tcpi_snd_rcv_wscale` map two bitfield fields stored in a u8
(struct_ == "tcp_info" && field == "tcpi_snd_rcv_wscale") ||
// the `tcpi_delivery_rate_app_limited` field is a bitfield on musl
(musl && struct_ == "tcp_info" && field == "tcpi_delivery_rate_app_limited") ||
// the `tcpi_fast_open_client_fail` field is a bitfield on musl
(musl && struct_ == "tcp_info" && field == "tcpi_fast_open_client_fail") ||
// the `tcpi_delivery_fastopen_bitfields` map two bitfield fields stored in a u8
(musl && struct_ == "tcp_info" && field == "tcpi_delivery_fastopen_bitfields") ||
// either fsid_t or int[2] type
(struct_ == "fanotify_event_info_fid" && field == "fsid") ||
// `handle` is a VLA
(struct_ == "fanotify_event_info_fid" && field == "handle")
(struct_ == "fanotify_event_info_fid" && field == "handle") ||
// invalid application of 'sizeof' to incomplete type 'long unsigned int[]'
(musl && struct_ == "mcontext_t" && field == "__extcontext" && loongarch64)
});

cfg.skip_roundtrip(move |s| match s {
Expand Down
15 changes: 15 additions & 0 deletions libc-test/semver/linux-gnu-loongarch64.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
KEYCTL_CAPABILITIES
KEYCTL_CAPS0_BIG_KEY
KEYCTL_CAPS0_CAPABILITIES
KEYCTL_CAPS0_DIFFIE_HELLMAN
KEYCTL_CAPS0_INVALIDATE
KEYCTL_CAPS0_MOVE
KEYCTL_CAPS0_PERSISTENT_KEYRINGS
KEYCTL_CAPS0_PUBLIC_KEY
KEYCTL_CAPS0_RESTRICT_KEYRING
KEYCTL_CAPS1_NS_KEYRING_NAME
KEYCTL_CAPS1_NS_KEY_TAG
KEYCTL_MOVE
MADV_SOFT_OFFLINE
PTRACE_GETFPREGS
PTRACE_GETFPXREGS
PTRACE_GETREGS
PTRACE_SETFPREGS
PTRACE_SETFPXREGS
PTRACE_SETREGS
PTRACE_SYSEMU
PTRACE_SYSEMU_SINGLESTEP
15 changes: 0 additions & 15 deletions libc-test/semver/linux-loongarch64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,11 @@ BPF_XOR
CIBAUD
FICLONE
FICLONERANGE
KEYCTL_CAPABILITIES
KEYCTL_CAPS0_BIG_KEY
KEYCTL_CAPS0_CAPABILITIES
KEYCTL_CAPS0_DIFFIE_HELLMAN
KEYCTL_CAPS0_INVALIDATE
KEYCTL_CAPS0_MOVE
KEYCTL_CAPS0_PERSISTENT_KEYRINGS
KEYCTL_CAPS0_PUBLIC_KEY
KEYCTL_CAPS0_RESTRICT_KEYRING
KEYCTL_CAPS1_NS_KEYRING_NAME
KEYCTL_CAPS1_NS_KEY_TAG
KEYCTL_MOVE
MADV_SOFT_OFFLINE
MAP_SYNC
NFT_MSG_DELOBJ
NFT_MSG_GETOBJ
NFT_MSG_GETOBJ_RESET
NFT_MSG_NEWOBJ
PTRACE_SYSEMU
PTRACE_SYSEMU_SINGLESTEP
SCM_TIMESTAMPNS
SCM_WIFI_STATUS
SIGSTKFLT
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/solarish.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ LIO_WAIT
LIO_WRITE
PIPE_BUF
SIGEV_PORT
_POSIX_VDISABLE
aio_cancel
aio_error
aio_fsync
Expand Down
1 change: 1 addition & 0 deletions src/unix/hurd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,7 @@ s! {
pub release: [::c_char; _UTSNAME_LENGTH],
pub version: [::c_char; _UTSNAME_LENGTH],
pub machine: [::c_char; _UTSNAME_LENGTH],
pub domainname: [::c_char; _UTSNAME_LENGTH],
}

pub struct rlimit64 {
Expand Down
3 changes: 3 additions & 0 deletions src/unix/linux_like/linux/arch/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,10 @@ cfg_if! {
pub const RLIMIT_RTPRIO: ::c_int = 14;
pub const RLIMIT_RTTIME: ::c_int = 15;
#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
#[cfg(not(target_arch = "loongarch64"))]
pub const RLIM_NLIMITS: ::c_int = 15;
#[cfg(target_arch = "loongarch64")]
pub const RLIM_NLIMITS: ::c_int = 16;
#[allow(deprecated)]
#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIMIT_NLIMITS: ::c_int = RLIM_NLIMITS;
Expand Down
Loading

0 comments on commit ae052d3

Please sign in to comment.