Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
afabf76
ci: Test riscv64gc-unknown-linux-musl
Gelbpunkt Sep 13, 2026
1d24b9f
musl: riscv64: REG_NARGS does not exist
Gelbpunkt Sep 13, 2026
68a55b4
musl: riscv64: Remove REG_* definitions gated under _GNU_SOURCE
Gelbpunkt Sep 13, 2026
122fce1
musl: riscv64: Fix name of uc_flags field in ucontext_t
Gelbpunkt Sep 13, 2026
72a86ef
musl: riscv64: Fix definition of ipc_perm
Gelbpunkt Sep 13, 2026
47747f1
musl: riscv64: Add SYS_futex_waitv
Gelbpunkt Sep 13, 2026
c3bf7a4
musl: riscv64: Fix the name of `__riscv_mc_q_ext_state.__reserved`
tgross35 Sep 17, 2026
8824255
ci: skip aix targets
dybucc Sep 20, 2026
0d6e222
uclibc: Replace `linux_time_bits64` with a new `uclibc32_time64` cfg
tgross35 Sep 20, 2026
187fedd
ci: Check building uclibc with `libc_unstable_uclibc_time64`
tgross35 Sep 20, 2026
d2d065b
crate: expose `cfg` for general time64
dybucc Aug 14, 2026
94ce88c
ci: make prevalent use of time64 `cfg`
dybucc Aug 29, 2026
6492fed
ci: format yaml
dybucc Sep 1, 2026
b28c81f
ci: use `TEST_MUSL_V1_2` in powerpc runs
dybucc Sep 10, 2026
e9e6e9c
ci: Drop `du` commands that are no longer needed
tgross35 Sep 21, 2026
f3576d4
test: Skip `AT_HANDLE_FID` for kernel < 6.5 and glibc < 2.39
tgross35 Sep 21, 2026
4539352
test: Skip `PR_MDWE_NO_INHERIT` for kernel < 6.7
tgross35 Sep 21, 2026
85d80cf
android: Fix RISC-V open flag radix
yujincheng08 Sep 23, 2026
6e2855d
unix: add HOST_NAME_MAX
Yasser-Ameur Sep 26, 2026
bc85078
freebsd: add `renameat2`
xjtu-ctgg Sep 25, 2026
bb531df
ci: use plain seconds for `sleep` in `bsd-prepare.sh`
xjtu-ctgg Sep 24, 2026
ce22498
Revert "ci: Pin docs toolchain to nightly-2026-08-02"
tgross35 Sep 21, 2026
56a57fb
test: Read FreeBSD version from the headers rather than environment
tgross35 Sep 29, 2026
299d42d
ci: Verify docs build without warnings on all targets
tgross35 Sep 29, 2026
a9c951c
ci: Remove a redundant profile setting
tgross35 Sep 29, 2026
c7922a1
linux: Move `socket.h` bits from `arch` to `src/new`
tgross35 Sep 21, 2026
d1b504f
freebsd: Add `AT_RENAME_*` and `RENAME_*` constants
drakeo338 Sep 29, 2026
b37d653
unix, apple: Switch uses of `s!` to `s2!`
tgross35 Sep 30, 2026
0c4f7d3
macros: Perform some mild simplification of patterns
tgross35 Sep 30, 2026
485ef90
macros: Accept `#[unsafe(union_default_via_zeroed)]`
tgross35 Sep 30, 2026
c9c05f6
Improve panic message for out-of-range fds in FD_* functions
danielcanencia Sep 13, 2026
cd04901
build: Make `linux_time_bits64` match the upstream definition
tgross35 Sep 20, 2026
a11b896
Fix CI for FreeBSD 15.1 and 16.0-CURRENT
asomers Sep 29, 2026
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
30 changes: 6 additions & 24 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
- toolchain: nightly
half: 2
- toolchain: beta
only: '(aarch64|x86_64)' # just a spot check for beta
only: "(aarch64|x86_64)" # just a spot check for beta
- toolchain: stable
- toolchain: 1.65.0 # msrv
runs-on: ubuntu-26.04
Expand All @@ -91,14 +91,9 @@ jobs:
if: matrix.toolchain == 'stable'
run: ./ci/prep-semver-baseline.sh

# FIXME(ci): These `du` statements are temporary for debugging cache
- name: Target size before restoring cache
run: du -sh target | sort -k 2 || true
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
key: ${{ matrix.os }}-${{ matrix.toolchain }}
- name: Target size after restoring cache
run: du -sh target | sort -k 2 || true

- name: Execute build check
run: |
Expand All @@ -118,8 +113,6 @@ jobs:
${BASELINE_CRATE_DIR:+"--baseline-crate-dir" "$BASELINE_CRATE_DIR"} \
${{ matrix.only && format('--only "{0}"', matrix.only) }} \
${{ matrix.half && format('--half "{0}"', matrix.half) }}
- name: Target size after job completion
run: du -sh target | sort -k 2

test_tier1:
name: Test tier1
Expand Down Expand Up @@ -215,14 +208,18 @@ jobs:
- target: powerpc64-unknown-linux-gnu
- target: powerpc64-unknown-linux-musl
- target: powerpc64-unknown-linux-musl
env: { RUST_LIBC_UNSTABLE_MUSL_V1_2: 1 }
env: { TEST_MUSL_V1_2: 1 }
artifact-tag: new-musl
- target: powerpc64le-unknown-linux-gnu
- target: powerpc64le-unknown-linux-musl
- target: powerpc64le-unknown-linux-musl
env: { TEST_MUSL_V1_2: 1 }
artifact-tag: new-musl
- target: riscv64gc-unknown-linux-gnu
- target: riscv64gc-unknown-linux-musl
- target: riscv64gc-unknown-linux-musl
env: { TEST_MUSL_V1_2: 1 }
artifact-tag: new-musl
- target: s390x-unknown-linux-gnu
- target: sparc64-unknown-linux-gnu
- target: wasm32-unknown-emscripten
Expand Down Expand Up @@ -375,20 +372,6 @@ jobs:
prepare: ./ci/bsd-prepare.sh ${{ matrix.target }}
run: ./ci/bsd-run.sh ${{ matrix.target }}

docs:
name: Ensure docs build
runs-on: ubuntu-26.04
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Rust
# FIXME(rust-lang/rust#160439): unpin once the issue is fixed
run: rustup update nightly-2026-08-02 --no-self-update && rustup default nightly-2026-08-02
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
- run: cargo doc --workspace --no-deps

zizmor:
name: Zizmor (Static analysis for GitHub Actions)
runs-on: ubuntu-26.04
Expand All @@ -415,7 +398,6 @@ jobs:
- test_tier2
- test_tier2_vm
- verify_build
- docs
- clippy
- zizmor
# GitHub branch protection is exceedingly silly and treats "jobs skipped because a dependency
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ targets = [
"powerpc64le-unknown-linux-gnu",
"powerpc64le-unknown-linux-musl",
"riscv64gc-unknown-linux-gnu",
"riscv64gc-unknown-linux-musl",
"s390x-unknown-linux-gnu",
"sparcv9-sun-solaris",
"x86_64-apple-darwin",
Expand Down Expand Up @@ -85,7 +86,6 @@ targets = [
"i686-unknown-freebsd",
"i686-unknown-linux-musl",
"nvptx64-nvidia-cuda",
"riscv64gc-unknown-linux-musl",
"sparc64-unknown-linux-gnu",
"thumbv7neon-linux-androideabi",
"thumbv7neon-unknown-linux-gnueabihf",
Expand Down
52 changes: 41 additions & 11 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ enum Cfg {

VxworksLt25_09,

/// Corresponds to `__USE_TIME_BITS64` in UAPI. Implies 32-bit Linux target.
/// Corresponds to `__USE_TIME_BITS64` in UAPI. Implies Linux and 64-bit `time_t`, but is set
/// on both 32-bit and 64-bit platforms.
LinuxTimeBits64,
/// Corresponds to `_FILE_OFFSET_BITS=64` in glibc. Implies 32-bit GNU target.
GnuFileOffsetBits64,
Expand All @@ -54,6 +55,9 @@ enum Cfg {
/// transition to 64-bit `time_t` and thus need `__*_time64` redirects. Implies `musl_v1_2`
/// and 32-bit arch.
MuslRedirTime64,
/// Corresponds to the `UCLIBC_USE_TIME64` config / `__UCLIBC_USE_TIME64__` define. Indicates
/// that `*time64` syscalls should be used. Implies 32-bit.
Uclibc32Time64,
}

const ALLOWED_CFGS: &[Cfg] = &[
Expand All @@ -76,6 +80,7 @@ const ALLOWED_CFGS: &[Cfg] = &[
Cfg::MuslV1_2,
Cfg::Musl32Time64,
Cfg::MuslRedirTime64,
Cfg::Uclibc32Time64,
];

impl fmt::Display for Cfg {
Expand All @@ -100,6 +105,7 @@ impl fmt::Display for Cfg {
Cfg::MuslV1_2 => "musl_v1_2",
Cfg::Musl32Time64 => "musl32_time64",
Cfg::MuslRedirTime64 => "musl_redir_time64",
Cfg::Uclibc32Time64 => "uclibc32_time64",
})
}
}
Expand Down Expand Up @@ -251,28 +257,25 @@ fn main() {
|| target_env == "ohos"
|| target_abi == "pauthtest";

// Single entry-point to enable `time64` on supported platforms.
let time64 = env_flag("CARGO_CFG_LIBC_UNSTABLE_TIME64");

// OpenHarmony uses a fork of the musl libc
let musl = target_env == "musl" || target_env == "ohos";
let musl_v1_2 = musl && (musl_v1_2_env || only_v1_2_on_musl);
let musl_v1_2 = musl && (musl_v1_2_env || only_v1_2_on_musl || time64);

if musl_v1_2 {
cfgs.push(Cfg::MuslV1_2);
cfgs.push(Cfg::LinuxTimeBits64);
if target_ptr_width == "32" {
cfgs.push(Cfg::Musl32Time64);
cfgs.push(Cfg::LinuxTimeBits64);
if !only_v1_2_on_musl {
// Older 32-bit arches need the redirects
cfgs.push(Cfg::MuslRedirTime64);
}
}
}

let uclibc_time64_env = env_flag("CARGO_CFG_LIBC_UNSTABLE_UCLIBC_TIME64");
let uclibc_time64 = target_env == "uclibc" && uclibc_time64_env;
if uclibc_time64 {
cfgs.push(Cfg::LinuxTimeBits64);
}

let mut gnu_tb_env = env::var("CARGO_CFG_LIBC_UNSTABLE_GNU_TIME_BITS");

// FIXME: remove these fallbacks in a few releases
Expand Down Expand Up @@ -307,7 +310,7 @@ fn main() {
|| target_arch == "x86_64"
|| !matches!(target_os.as_str(), "linux" | "windows" | "hurd");
let gnu = target_env == "gnu";
let gnu32_time64 = gnu && target_ptr_width == "32" && gnu32_timebits == "64";
let gnu32_time64 = gnu && target_ptr_width == "32" && (gnu32_timebits == "64" || time64);

if gnu32_time64 && !gnu32_already_time64 {
// These configs all set up nonstandard options. They are not needed on platforms like
Expand All @@ -319,6 +322,22 @@ fn main() {
cfgs.push(Cfg::GnuTimeBits64);
}

let uclibc_time64_env = env_flag("CARGO_CFG_LIBC_UNSTABLE_UCLIBC_TIME64");
let uclibc = target_env == "uclibc";
let uclibc32_time64 = uclibc && target_ptr_width == "32" && (uclibc_time64_env || time64);

if uclibc32_time64 {
if target_os == "linux" {
cfgs.push(Cfg::LinuxTimeBits64);
}
cfgs.push(Cfg::Uclibc32Time64);
}

// `__USE_TIME_BITS64` is set on any platform if `time_t` is 64 bits.
if target_os == "linux" && target_ptr_width == "64" {
cfgs.push(Cfg::LinuxTimeBits64);
}

// On CI: deny all warnings
if libc_ci {
cfgs.push(Cfg::LibcDenyWarnings);
Expand Down Expand Up @@ -467,7 +486,6 @@ fn validate_cfg(list: &[Cfg], target_env: &str, target_os: &str, target_ptr_widt
}
Cfg::LinuxTimeBits64 => {
assert_eq!(target_os, "linux", "{cfg:?} set on non-linux platform");
assert_eq!(target_ptr_width, "32", "{cfg:?} set on non-32-bit platform");
}
Cfg::MuslV1_2 => {
assert!(
Expand Down Expand Up @@ -497,6 +515,16 @@ fn validate_cfg(list: &[Cfg], target_env: &str, target_os: &str, target_ptr_widt
"{cfg:?} set on non-musl1.2 platform"
)
}
Cfg::Uclibc32Time64 => {
assert_eq!(target_env, "uclibc", "{cfg:?} set on non-gnu platform");
assert_eq!(target_ptr_width, "32", "{cfg:?} set on non-32-bit platform");
if target_os == "linux" {
assert!(
list.contains(&Cfg::LinuxTimeBits64),
"missing 64-bit time_t Linux config"
)
}
}
}
}
}
Expand All @@ -516,6 +544,8 @@ fn which_freebsd() -> Option<i32> {
s if s.starts_with("13") => Some(13),
s if s.starts_with("14") => Some(14),
s if s.starts_with("15") => Some(15),
// Until we have a need to treat them separately, treat FreeBSD 16 like 15
s if s.starts_with("16") => Some(15),
_ => None,
}
}
Expand Down
2 changes: 1 addition & 1 deletion ci/bsd-prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ success=false
while [ $count -lt 3 ]; do
$deps && success=true || true
[ $success = true ] && break
sleep 3s
sleep 3
count=$(( count + 1))
done

Expand Down
24 changes: 24 additions & 0 deletions ci/docker/riscv64gc-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM ubuntu:26.04

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

ARG MUSL_VERSION
COPY . /ci
RUN ci/install-musl.sh riscv64 "$MUSL_VERSION"

ENV PATH=$PATH:/musl-riscv64/bin:/rust/bin \
CC_riscv64gc_unknown_linux_musl=musl-gcc \
CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc \
CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_MUSL_RUNNER="qemu-riscv64 -L /musl-riscv64" \
EXTRA_RUSTFLAGS="-Ctarget-feature=+crt-static -Clink-args=-L/musl-riscv64/lib"
7 changes: 7 additions & 0 deletions ci/install-musl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ case ${1} in
./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes
make install -j4
;;
riscv64)
musl_arch=riscv64
kernel_arch=riscv
CC=riscv64-linux-gnu-gcc \
./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes
make install -j4
;;
*)
echo "Unknown target arch: \"${1}\""
exit 1
Expand Down
1 change: 0 additions & 1 deletion ci/install-rust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ esac

if [ "$os" = "windows" ] && [ -n "${TARGET:-}" ]; then
toolchain="$toolchain-${RUST_HOST:-$TARGET}"
rustup set profile minimal
fi

rustup set profile minimal
Expand Down
2 changes: 1 addition & 1 deletion ci/run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ run() {

if [ -n "${TEST_UCLIBC_TIME64:-}" ]; then
build_args+=("--build-arg=TEST_UCLIBC_TIME64=1")
RUSTFLAGS="$RUSTFLAGS --cfg=libc_unstable_uclibc_time64"
RUSTFLAGS="$RUSTFLAGS --cfg=libc_unstable_time64"
fi
if [[ "$run_target" = *-linux-uclibc* ]]; then
if [ "${UCLIBC_TOOLCHAIN_URL:-}" ]; then
Expand Down
4 changes: 3 additions & 1 deletion ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ $cmd -- $test_flags
# shellcheck disable=SC2086
$cmd --features extra_traits -- $test_flags

cargo doc --target "$target" --workspace --no-deps

# On relevant platforms, also test with our optional settings

if [ "$env" = "gnu" ] && [ "$bits" = "32" ]; then
# shellcheck disable=SC2086
RUSTFLAGS="$RUSTFLAGS --cfg=libc_unstable_gnu_time_bits=\"64\"" $cmd -- $test_flags
RUSTFLAGS="$RUSTFLAGS --cfg=libc_unstable_time64" $cmd -- $test_flags
fi
24 changes: 15 additions & 9 deletions ci/verify-build.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class TargetResult:
Target("powerpc64le-unknown-linux-gnu"),
Target("powerpc64le-unknown-linux-musl", min_toolchain=Toolchain.STABLE),
Target("riscv64gc-unknown-linux-gnu"),
Target("riscv64gc-unknown-linux-musl", min_toolchain=Toolchain.STABLE),
Target("s390x-unknown-linux-gnu"),
Target("sparcv9-sun-solaris"),
Target("x86_64-apple-darwin"),
Expand Down Expand Up @@ -141,7 +142,6 @@ class TargetResult:
Target("i686-unknown-freebsd"),
Target("i686-unknown-linux-musl"),
Target("nvptx64-nvidia-cuda", min_toolchain=Toolchain.STABLE),
Target("riscv64gc-unknown-linux-musl", min_toolchain=Toolchain.STABLE),
Target("sparc64-unknown-linux-gnu"),
Target("thumbv7neon-linux-androideabi", min_toolchain=Toolchain.STABLE),
Target("thumbv7neon-unknown-linux-gnueabihf", min_toolchain=Toolchain.STABLE),
Expand Down Expand Up @@ -192,7 +192,8 @@ class TargetResult:
Target("powerpc-unknown-netbsd", dist=False),
Target("powerpc-wrs-vxworks", dist=False),
Target("powerpc-wrs-vxworks-spe", dist=False),
Target("powerpc64-ibm-aix", dist=False),
# FIXME(rust-lang/rust#162979)
# Target("powerpc64-ibm-aix", dist=False),
Target("powerpc64-unknown-freebsd", dist=False),
Target("powerpc64-unknown-linux-gnuelfv2", dist=False),
Target("powerpc64-wrs-vxworks", dist=False),
Expand Down Expand Up @@ -412,13 +413,18 @@ def test_target(cfg: Cfg, target: Target) -> TargetResult:
run(cmd, rustflags=rustflags)
run([*cmd, "--features=extra_traits"], rustflags=rustflags)

if "gnu" in target_env and target_bits == "32":
# Equivalent of _TIME_BITS=64
run(cmd, rustflags=f'{rustflags} --cfg=libc_unstable_gnu_time_bits="64"')

if "musl" in target_env:
# Check with breaking changes from musl, including 64-bit time_t on 32-bit
run(cmd, rustflags=f"{rustflags} --cfg=libc_unstable_musl_v1_2")
if (
("gnu" in target_env and target_bits == "32")
or "musl" in target_env
or "uclibc" in target_env
):
# Global toggle for `_TIME_BITS=64` on glibc, musl breaking changes and
# uClibc buil-time options concerning 64-bit `time_t`.
run(cmd, rustflags=f"{rustflags} --cfg=libc_unstable_time64")

if "uclibc" in target_env:
# Equivalent of UCLIBC_USE_TIME64 on 32-bit targets, ignored on 64-bit
run(cmd, rustflags=f"{rustflags} --cfg=libc_unstable_uclibc_time64")

# Test again without default features, i.e. without `std`
run([*cmd, "--no-default-features"], rustflags=rustflags)
Expand Down
Loading
Loading