Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions ci/docker/armv7-unknown-linux-uclibceabihf/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
FROM ubuntu:23.10
FROM ubuntu:25.04

# FIXME(time): we are using an EOL release because 24.04 changes to 64-bit time
RUN sed -i -E 's/(archive|security)\.ubuntu\.com/old-releases.ubuntu.com/g' \
/etc/apt/sources.list && \
apt-get update && apt-get install -y --no-install-recommends \
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
file \
gcc \
libc6-dev \
patch \
qemu-system-arm \
qemu-user \
bzip2 \
gzip \
cpio \
unzip \
rsync \
bc \
xz-utils

ARG TEST_UCLIBC_TIME64
ARG UCLIBC_TOOLCHAIN_URL
COPY install-uclibc.sh /
RUN /install-uclibc.sh "$TEST_UCLIBC_TIME64"
RUN /install-uclibc.sh "$UCLIBC_TOOLCHAIN_URL"

ENV PATH=$PATH:/rust/bin:/toolchain/bin \
STAGING_DIR=/toolchain/armv7-buildroot-linux-uclibceabihf/sysroot \
CC_armv7_unknown_linux_uclibceabihf=arm-buildroot-linux-uclibcgnueabihf-gcc \
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_UCLIBCEABIHF_LINKER=arm-buildroot-linux-uclibcgnueabihf-gcc \
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_UCLIBCEABIHF_RUNNER="qemu-arm -L /toolchain/arm-buildroot-linux-uclibcgnueabihf/sysroot/"
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_UCLIBCEABIHF_RUNNER="qemu-arm -L /toolchain/arm-buildroot-linux-uclibcgnueabihf/sysroot/"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"uclibc: move to configurable external prebuilt toolchain": missing trailing \n

22 changes: 10 additions & 12 deletions ci/install-uclibc.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
#!/bin/bash
#
# Installs the appropriate uclibc toolchain into /toolchain
# Builds a buildroot uclibc toolchain into /buildroot/output/host/
#
# usage: install-uclibc.sh BUILDROOT_TOOLCHAIN_URL

set -eux

time64="$1"

if [ "${time64:-0}" != "0" ]; then
version='bleeding-edge-2025.08-1'
else
version='bleeding-edge-2024.02-1' # last version with 32-bit time_t
fi
toolchain_url="$1"

mkdir /toolchain

curl --retry 5 -L "https://toolchains.bootlin.com/downloads/releases/toolchains/armv7-eabihf/tarballs/armv7-eabihf--uclibc--${version}.tar.bz2" |
tar xjf - -C /toolchain --strip-components=1

curl --retry 5 -L "$toolchain_url" | tar xzf - -C /toolchain --strip-components=1
if ! [ -f /toolchain/relocate-sdk.sh ]; then
echo "ERROR: toolchain does not contain relocate-sdk.sh, expecting a buildroot SDK."
exit 1
fi
/toolchain/relocate-sdk.sh

11 changes: 10 additions & 1 deletion ci/run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,17 @@ run() {

if [ -n "${TEST_UCLIBC_TIME64:-}" ]; then
build_args+=("--build-arg=TEST_UCLIBC_TIME64=1")
export RUSTFLAGS="$RUSTFLAGS --cfg=libc_unstable_uclibc_time64"
export RUSTFLAGS="${RUSTFLAGS:-} --cfg=libc_unstable_uclibc_time64"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"uclibc: move to configurable external prebuilt toolchain": maybe just export RUSTFLAGS="${RUSTFLAGS:-}" at the top of run() so we only need that in one place

fi
if [[ "$run_target" = *-linux-uclibc* ]]; then
if [ "${UCLIBC_TOOLCHAIN_URL:-}" ]; then
build_args+=("--build-arg=UCLIBC_TOOLCHAIN_URL=$UCLIBC_TOOLCHAIN_URL")
else
echo "Expected a URL to a UCLIBC toolchain in \$UCLIBC_TOOLCHAIN_URL"
exit 1
fi
fi


# use -f so we can use ci/ as build context
docker build "${build_args[@]}"
Expand Down
5 changes: 5 additions & 0 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ case "$target" in
powerpc64le*musl) cmd="$cmd --exclude ctest --exclude ctest-test --exclude ctest-next" ;;
esac

if [ "${LIBC_CI_ZBUILD_STD:-}" ]; then
# ctest test infrastructure has no support for -Zbuild-std
cmd="$cmd --exclude ctest --exclude ctest-test"
fi

env="$(rustc --print cfg --target "$target" | sed -n 's/target_env="\(.*\)"/\1/p')"
bits="$(rustc --print cfg --target "$target" | sed -n 's/target_pointer_width="\(.*\)"/\1/p')"

Expand Down
117 changes: 0 additions & 117 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4651,123 +4651,6 @@ fn test_linux(target: &str) {

if uclibc {
match name {
// The canonical uClibc toolchain, bootlin bleeding-edge-2024.02-1,
// uses linux 5.15, so several constants are not available.

// requires linux 5.16
"PR_SCHED_CORE_SCOPE_PROCESS_GROUP"
| "PR_SCHED_CORE_SCOPE_THREAD_GROUP"
| "PR_SCHED_CORE_SCOPE_THREAD"
| "NF_NETDEV_EGRESS"
| "SO_RESERVE_MEM" => return true,

// TLS_CIPHER_SM4_[GC]CM requires linux 5.16
"TLS_CIPHER_SM4_CCM_IV_SIZE"
| "TLS_CIPHER_SM4_CCM_KEY_SIZE"
| "TLS_CIPHER_SM4_CCM_REC_SEQ_SIZE"
| "TLS_CIPHER_SM4_CCM_SALT_SIZE"
| "TLS_CIPHER_SM4_CCM_TAG_SIZE"
| "TLS_CIPHER_SM4_CCM"
| "TLS_CIPHER_SM4_GCM_IV_SIZE"
| "TLS_CIPHER_SM4_GCM_KEY_SIZE"
| "TLS_CIPHER_SM4_GCM_REC_SEQ_SIZE"
| "TLS_CIPHER_SM4_GCM_SALT_SIZE"
| "TLS_CIPHER_SM4_GCM_TAG_SIZE"
| "TLS_CIPHER_SM4_GCM" => return true,

// requires linux 5.17
"PR_SET_VMA_ANON_NAME"
| "PR_SET_VMA"
| "RTNLGRP_MCTP_IFADDR" => return true,

// requires linux 5.18
"RTNLGRP_STATS"
| "RTNLGRP_TUNNEL"
| "TLS_TX_ZEROCOPY_RO"
| "MADV_DONTNEED_LOCKED"
| "NFQA_PRIORITY"
| "SO_TXREHASH" => return true,

// requires linux 5.19
"SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV"
| "NLM_F_BULK"
| "SO_RCVMARK"
| "TLS_INFO_ZC_RO_TX" => return true,

// CAN_* consts requiring linux 6.0
"CAN_BUS_OFF_THRESHOLD"
| "CAN_CTRLMODE_TDC_AUTO"
| "CAN_CTRLMODE_TDC_MANUAL"
| "CAN_ERR_CNT"
| "CAN_ERROR_PASSIVE_THRESHOLD"
| "CAN_ERROR_WARNING_THRESHOLD" => return true,

// requires linux 6.0
"IFF_NO_CARRIER"
| "TLS_INFO_RX_NO_PAD"
| "TLS_RX_EXPECT_NO_PAD" => return true,

// CAN_* consts requiring linux 6.1
"CAN_RAW_XL_FRAMES"
| "CANXL_HDR_SIZE"
| "CANXL_MAX_DLC_MASK"
| "CANXL_MAX_DLC"
| "CANXL_MAX_DLEN"
| "CANXL_MAX_MTU"
| "CANXL_MIN_DLC"
| "CANXL_MIN_DLEN"
| "CANXL_MIN_MTU"
| "CANXL_MTU"
| "CANXL_PRIO_BITS"
| "CANXL_PRIO_MASK"
| "CANXL_SEC"
| "CANXL_XLF" => return true,

// TLS_CIPHER_ARIA_GCM_* requires linux 6.1
"TLS_CIPHER_ARIA_GCM_128_IV_SIZE"
| "TLS_CIPHER_ARIA_GCM_128_KEY_SIZE"
| "TLS_CIPHER_ARIA_GCM_128_REC_SEQ_SIZE"
| "TLS_CIPHER_ARIA_GCM_128_SALT_SIZE"
| "TLS_CIPHER_ARIA_GCM_128_TAG_SIZE"
| "TLS_CIPHER_ARIA_GCM_128"
| "TLS_CIPHER_ARIA_GCM_256_IV_SIZE"
| "TLS_CIPHER_ARIA_GCM_256_KEY_SIZE"
| "TLS_CIPHER_ARIA_GCM_256_REC_SEQ_SIZE"
| "TLS_CIPHER_ARIA_GCM_256_SALT_SIZE"
| "TLS_CIPHER_ARIA_GCM_256_TAG_SIZE"
| "TLS_CIPHER_ARIA_GCM_256" => return true,

// requires linux 6.2
"ALG_SET_KEY_BY_KEY_SERIAL"
| "PACKET_FANOUT_FLAG_IGNORE_OUTGOING"
| "SOF_TIMESTAMPING_OPT_ID_TCP"
| "TUN_F_USO4"
| "TUN_F_USO6" => return true,

// FAN_* consts require kernel 6.3
"FAN_INFO"
| "FAN_RESPONSE_INFO_AUDIT_RULE"
| "FAN_RESPONSE_INFO_NONE" => return true,

// requires linux 6.3
"MFD_EXEC"
| "MFD_NOEXEC_SEAL"
| "PR_GET_MDWE"
| "PR_SET_MDWE" => return true,

// requires linux 6.4
"PACKET_VNET_HDR_SZ" => return true,
"PR_GET_MEMORY_MERGE" => return true,
"PR_SET_MEMORY_MERGE" => return true,

// requires linux 6.5
"SO_PASSPIDFD"
| "SO_PEERPIDFD" => return true,

// requires linux 6.6
"PR_MDWE_NO_INHERIT"
| "PR_MDWE_REFUSE_EXEC_GAIN" => return true,

// defined as a synonym for EM_ARC_COMPACT in gnu but not uclibc
"EM_ARC_A5" => return true,

Expand Down
2 changes: 1 addition & 1 deletion src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ s! {
}

cfg_if! {
if #[cfg(not(target_env = "gnu"))] {
if #[cfg(not(any(target_env = "gnu", target_env = "uclibc")))] {
extern_ty! {
pub type fpos64_t; // FIXME(linux): fill this out with a struct
}
Expand Down
3 changes: 3 additions & 0 deletions src/unix/linux_like/linux/uclibc/arm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,13 @@ s! {
pub shm_perm: crate::ipc_perm,
pub shm_segsz: size_t,
pub shm_atime: crate::time_t,
#[cfg(not(linux_time_bits64))]
__unused1: Padding<c_ulong>,
pub shm_dtime: crate::time_t,
#[cfg(not(linux_time_bits64))]
__unused2: Padding<c_ulong>,
pub shm_ctime: crate::time_t,
#[cfg(not(linux_time_bits64))]
__unused3: Padding<c_ulong>,
pub shm_cpid: crate::pid_t,
pub shm_lpid: crate::pid_t,
Expand Down
11 changes: 11 additions & 0 deletions src/unix/linux_like/linux/uclibc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,17 @@ s! {
pub tcpi_rcv_space: u32,
pub tcpi_total_retrans: u32,
}

pub struct mbstate_t {
__mask: crate::wchar_t,
__wc: crate::wchar_t,
}

pub struct fpos64_t {
__pos: off64_t,
__mbstate: crate::mbstate_t,
__mblen_pending: c_int,
}
}

impl siginfo_t {
Expand Down
2 changes: 0 additions & 2 deletions src/unix/linux_like/linux_l4re_shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,6 @@ pub const EM_M32R: u16 = 88;
pub const EM_MN10300: u16 = 89;
pub const EM_MN10200: u16 = 90;
pub const EM_PJ: u16 = 91;
#[cfg(not(target_env = "uclibc"))]
pub const EM_OPENRISC: u16 = 92;
#[cfg(target_env = "uclibc")]
pub const EM_OR1K: u16 = 92;
Expand Down Expand Up @@ -874,7 +873,6 @@ pub const AT_EXECFN: c_ulong = 31;
// defined in arch/<arch>/include/uapi/asm/auxvec.h but has the same value
// wherever it is defined.
pub const AT_SYSINFO_EHDR: c_ulong = 33;
#[cfg(not(target_env = "uclibc"))]
pub const AT_MINSIGSTKSZ: c_ulong = 51;

pub const GLOB_ERR: c_int = 1 << 0;
Expand Down