Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
0a1791b
Add interface LINK_STATE_* definitions from sys/net/if.h
pusateri Dec 5, 2025
e87910a
Remove nonexistent clocks on WASI
alexcrichton Dec 10, 2025
9ddb990
Revert the workaround for Rust bug 132185
asomers Dec 11, 2025
2a30c24
libc-test: semver: Move Linux s390x ucontext symbols to GNU symbol list
Gelbpunkt Dec 16, 2025
66b08e8
musl: s390x: Fix definition of SIGSTKSZ/MINSIGSTKSZ
Gelbpunkt Dec 16, 2025
bf44882
Add AT_EXECVE_CHECK
rusty-snake Apr 16, 2025
24b2338
aix: Fix swapped struct/union test skips and missing `c_enum`
xingxue-ibm Dec 4, 2025
c29def3
musl: riscv: fix public padding fields in `stat/stat64`
xbjfk Oct 30, 2025
46758b8
musl: Merge stat64 and stat with `stat`
xbjfk Oct 30, 2025
89688c5
musl: add musl_time64 feature
xbjfk May 13, 2025
4089c85
musl: time64: adjust struct timespec definition
xbjfk May 13, 2025
98532ed
musl: time64: set link names for symbols
xbjfk May 13, 2025
02d273b
musl: time64: update struct sched_param
xbjfk May 13, 2025
918b541
musl: convert inline timespecs to timespec
xbjfk Dec 4, 2025
21d3b84
musl: time64: change time_t type and structs
xbjfk May 19, 2025
1626e1a
musl: time64: update {IPC,MSG,SEM}_STAT definitions
xbjfk May 19, 2025
761901c
semver: linux powerpc: split GNU-specific symbols into own file.
xbjfk May 24, 2025
db00c43
libc-test: add allowlist for positive s! marco configs
xbjfk Jun 26, 2025
0a9180b
libc-test: delete handle_s_macro_no_attrs
xbjfk Oct 30, 2025
9826b56
Revert "test: Skip `input_event.time` on recent musl"
xbjfk Dec 4, 2025
b4a456d
Revert "test: musl: Skip time64-dependent API on new musl"
xbjfk Dec 4, 2025
9e9c6f8
newlib: Fix ambiguous glob exports and other warnings for Vita and 3DS
pheki Dec 4, 2025
1de6920
getitimer and setitimer for linux
youknowone Dec 26, 2025
1772e95
Add NAME_MAX for Linux (like)
Thomasdezeeuw Dec 21, 2025
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
3 changes: 0 additions & 3 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ task:
env:
HOME: /tmp # cargo cache needs it
TARGET: x86_64-unknown-freebsd
# FIXME(freebsd): FreeBSD has a segfault when `RUST_BACKTRACE` is set
# https://github.com/rust-lang/rust/issues/132185
RUST_BACKTRACE: "0"
matrix:
# FIXME(#4740): FreeBSD 13 tests are extremely flaky and fail most of the time
# - name: nightly freebsd-13 x86_64
Expand Down
30 changes: 26 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ const ALLOWED_CFGS: &[&str] = &[
// Corresponds to `__USE_TIME_BITS64` in UAPI
"linux_time_bits64",
"musl_v1_2_3",
// Corresponds to `_REDIR_TIME64` in musl
"musl32_time64",
"vxworks_lt_25_09",
];

Expand All @@ -49,6 +51,9 @@ const CHECK_CFG_EXTRA: &[(&str, &[&str])] = &[
),
];

/// Musl architectures that set `#define _REDIR_TIME64 1`.
const MUSL_REDIR_TIME64_ARCHES: &[&str] = &["arm", "mips", "powerpc", "x86"];

fn main() {
// Avoid unnecessary re-building.
println!("cargo:rerun-if-changed=build.rs");
Expand Down Expand Up @@ -99,12 +104,29 @@ fn main() {
_ => (),
}

let musl_v1_2_3 = env_flag("RUST_LIBC_UNSTABLE_MUSL_V1_2_3");
let mut musl_v1_2_3 = env_flag("RUST_LIBC_UNSTABLE_MUSL_V1_2_3");
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_MUSL_V1_2_3");
// loongarch64 and ohos have already updated
if musl_v1_2_3 || target_arch == "loongarch64" || target_env == "ohos" {
// FIXME(musl): enable time64 api as well

// OpenHarmony uses a fork of the musl libc
let musl = target_env == "musl" || target_env == "ohos";

// loongarch64 and ohos only exist with recent musl
if target_arch == "loongarch64" || target_env == "ohos" {
musl_v1_2_3 = true;
}

if musl && musl_v1_2_3 {
set_cfg("musl_v1_2_3");
if MUSL_REDIR_TIME64_ARCHES.contains(&target_arch.as_str()) {
set_cfg("musl32_time64");
set_cfg("linux_time_bits64");
}
}

let linux_time_bits64 = env::var("RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64").is_ok();
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64");
if linux_time_bits64 {
set_cfg("linux_time_bits64");
}
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS");
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_GNU_TIME_BITS");
Expand Down
120 changes: 30 additions & 90 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3836,6 +3836,7 @@ fn test_linux(target: &str) {
let i686 = target.contains("i686");
let ppc = target.contains("powerpc");
let ppc64 = target.contains("powerpc64");
let ppc32 = ppc && !ppc64;
let s390x = target.contains("s390x");
let sparc64 = target.contains("sparc64");
let x32 = target.contains("x32");
Expand All @@ -3848,6 +3849,8 @@ fn test_linux(target: &str) {
let wasm32 = target.contains("wasm32");
let uclibc = target.contains("uclibc");
let mips = target.contains("mips");
let mips64 = target.contains("mips64");
let mips32 = mips && !mips64;

let musl_v1_2_3 = env::var("RUST_LIBC_UNSTABLE_MUSL_V1_2_3").is_ok();
if musl_v1_2_3 {
Expand All @@ -3856,8 +3859,12 @@ fn test_linux(target: &str) {
let old_musl = musl && !musl_v1_2_3;

let mut cfg = ctest_cfg();
if musl_v1_2_3 {
if (musl_v1_2_3 || loongarch64) && musl {
cfg.cfg("musl_v1_2_3", None);
if arm || ppc32 || x86_32 || mips32 {
cfg.cfg("musl32_time64", None);
cfg.cfg("linux_time_bits64", None);
}
}
cfg.define("_GNU_SOURCE", None)
// This macro re-defines fscanf,scanf,sscanf to link to the symbols that are
Expand Down Expand Up @@ -4111,9 +4118,9 @@ fn test_linux(target: &str) {
cfg.rename_struct_field(move |struct_, field| {
match (struct_.ident(), field.ident()) {
// Our stat *_nsec fields normally don't actually exist but are part
// of a timeval struct
// of a timeval struct - this is fixed in musl_v1_2_3
("stat" | "statfs" | "statvfs" | "stat64" | "statfs64" | "statvfs64", f)
if f.ends_with("_nsec") =>
if !musl_v1_2_3 && f.ends_with("_nsec") =>
{
Some(f.replace("e_nsec", ".tv_nsec"))
}
Expand Down Expand Up @@ -4638,6 +4645,9 @@ fn test_linux(target: &str) {
// FIXME(linux): Requires >= 6.9 kernel headers.
"AT_HWCAP3" | "AT_HWCAP4" => true,

// Linux 6.14
"AT_EXECVE_CHECK" => true,

_ => false,
}
});
Expand Down Expand Up @@ -4883,8 +4893,6 @@ fn test_linux(target: &str) {
("xsk_tx_metadata", "xsk_tx_metadata_union") => true,
// After musl 1.2.0, the type becomes `int` instead of `long`.
("utmpx", "ut_session") if musl => true,
// FIXME(musl,time): changed with the musl time updates
("input_event", "time") if musl_v1_2_3 => true,
// `frames` is a flexible array member
("bcm_msg_head", "frames") => true,
// FAM
Expand Down Expand Up @@ -4939,83 +4947,6 @@ fn test_linux(target: &str) {
_ => false,
});

// FIXME(musl,time): these should be resolved with the time64 updates
if musl_v1_2_3 {
// Time primitives changed, as did structs containing them
cfg.skip_alias(|ty| match ty.ident() {
"time_t" | "suseconds_t" => true,
_ => false,
});
cfg.skip_struct(|s| match s.ident() {
"utimbuf" | "timeval" | "timespec" | "rusage" | "itimerval" | "itimerspec"
| "timex" | "ntptimeval" | "stat" | "shmid_ds" | "msqid_ds" => true,
_ => false,
});

cfg.skip_const(|c| match c.ident() {
// Changed syscall numbers under `linux_time_bits64`
"SO_TIMESTAMP" | "SO_TIMESTAMPNS" | "SO_TIMESTAMPING" | "SO_RCVTIMEO"
| "SO_SNDTIMEO" => true,
// Derived from `SO_` constants
"SCM_TIMESTAMP" | "SCM_TIMESTAMPNS" | "SCM_TIMESTAMPING" => true,
// `IPC_STAT` and derived values
"IPC_STAT" | "SEM_STAT" | "SEM_STAT_ANY" => true,
_ => false,
});

// Functions that got a new link name
cfg.skip_fn_ptrcheck(|f| match f {
"pthread_mutex_timedlock"
| "recvmmsg"
| "fstat"
| "stat"
| "fstatat"
| "nanosleep"
| "utime"
| "lstat"
| "getrusage"
| "pthread_cond_timedwait"
| "utimes"
| "dlsym"
| "gmtime_r"
| "localtime_r"
| "mktime"
| "time"
| "gmtime"
| "localtime"
| "difftime"
| "timegm"
| "select"
| "adjtime"
| "pselect"
| "clock_getres"
| "clock_gettime"
| "clock_settime"
| "futimens"
| "utimensat"
| "wait4"
| "aio_suspend"
| "futimes"
| "mq_timedreceive"
| "mq_timedsend"
| "lutimes"
| "timerfd_gettime"
| "timerfd_settime"
| "sigtimedwait"
| "settimeofday"
| "sched_rr_get_interval"
| "sem_timedwait"
| "ppoll"
| "clock_nanosleep"
| "timer_gettime"
| "timer_settime"
| "gettimeofday"
| "adjtimex"
| "clock_adjtime" => true,
_ => false,
});
}

ctest::generate_test(&mut cfg, "../src/lib.rs", "ctest_output.rs").unwrap();

if !l4re {
Expand Down Expand Up @@ -5658,14 +5589,24 @@ fn test_aix(target: &str) {
// FIXME(union): actually a union.
"sigval" => true,

// '__poll_ctl_ext_u' and '__pollfd_ext_u' are for unnamed unions.
"__poll_ctl_ext_u" => true,
"__pollfd_ext_u" => true,

// 'struct fpreg_t' is not defined in AIX headers. It is created to
// allow type 'double' to be used in signal contexts.
"fpreg_t" => true,

// These structures are guarded by the `_KERNEL` macro in the AIX
// header.
"fileops_t" | "file" => true,

_ => false,
}
});

cfg.skip_union(|union_| {
match union_.ident() {
// '__poll_ctl_ext_u' and '__pollfd_ext_u' are for unnamed unions.
"__poll_ctl_ext_u" => true,
"__pollfd_ext_u" => true,

// This type is defined for a union used within `struct ld_info`.
// The AIX header does not declare a separate standalone union
// type for it.
Expand All @@ -5674,10 +5615,6 @@ fn test_aix(target: &str) {
// This is a simplified version of the AIX union `_simple_lock`.
"_kernel_simple_lock" => true,

// These structures are guarded by the `_KERNEL` macro in the AIX
// header.
"fileops_t" | "file" => true,

_ => false,
}
});
Expand Down Expand Up @@ -5804,6 +5741,9 @@ fn test_aix(target: &str) {
_ => false,
});

let c_enums = ["uio_rw"];
cfg.alias_is_c_enum(move |e| c_enums.contains(&e));

ctest::generate_test(&mut cfg, "../src/lib.rs", "ctest_output.rs").unwrap();
}

Expand Down
6 changes: 6 additions & 0 deletions libc-test/semver/linux-gnu-s390x.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
getcontext
makecontext
mcontext_t
setcontext
swapcontext
sysctl
ucontext_t
16 changes: 16 additions & 0 deletions libc-test/semver/linux-powerpc-gnu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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
PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
sysctl
16 changes: 0 additions & 16 deletions libc-test/semver/linux-powerpc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,12 @@ B2500000
B3000000
B3500000
B4000000
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
PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
PTRACE_GETFPREGS
PTRACE_GETREGS
PTRACE_SETFPREGS
Expand Down Expand Up @@ -158,4 +143,3 @@ TIOCSRS485
flock64
fsblkcnt64_t
fsfilcnt64_t
sysctl
6 changes: 0 additions & 6 deletions libc-test/semver/linux-s390x.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,5 @@ __psw_t
flock64
fpreg_t
fpregset_t
getcontext
greg_t
makecontext
mcontext_t
setcontext
swapcontext
termios2
ucontext_t
2 changes: 2 additions & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ AT_ENTRY
AT_EUID
AT_EXECFD
AT_EXECFN
AT_EXECVE_CHECK
AT_FDCWD
AT_FLAGS
AT_GID
Expand Down Expand Up @@ -1750,6 +1751,7 @@ MS_SLAVE
MS_STRICTATIME
MS_SYNCHRONOUS
MS_UNBINDABLE
NAME_MAX
NDA_CACHEINFO
NDA_DST
NDA_IFINDEX
Expand Down
Loading