Skip to content

[0.2] Backports #4270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 18, 2025
Merged
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ but this is not guaranteed.
You can see the platform(target)-specific docs on [docs.rs], select a platform
you want to see.

See [`ci/build.sh`](https://github.com/rust-lang/libc/blob/HEAD/ci/build.sh) for
See [`ci/verify-build.sh`](https://github.com/rust-lang/libc/blob/HEAD/ci/verify-build.sh) for
the platforms on which `libc` is guaranteed to build for each Rust toolchain.
The test-matrix at [GitHub Actions] and [Cirrus CI] show the platforms in which
`libc` tests are run.
8 changes: 4 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ use std::{env, str};
// need to know all the possible cfgs that this script will set. If you need to set another cfg
// make sure to add it to this list as well.
const ALLOWED_CFGS: &'static [&'static str] = &[
"emscripten_new_stat_abi",
"emscripten_old_stat_abi",
"espidf_time32",
"freebsd10",
"freebsd11",
@@ -74,9 +74,9 @@ fn main() {
}

match emcc_version_code() {
Some(v) if (v >= 30142) => set_cfg("emscripten_new_stat_abi"),
// Non-Emscripten or version < 3.1.42.
Some(_) | None => (),
Some(v) if (v < 30142) => set_cfg("emscripten_old_stat_abi"),
// Non-Emscripten or version >= 3.1.42.
_ => (),
}

// On CI: deny all warnings
2 changes: 1 addition & 1 deletion ci/emscripten.sh
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
set -eux

# Note: keep in sync with:
# https://github.com/rust-lang/rust/blob/master/src/ci/docker/scripts/emscripten.sh
# https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support/wasm32-unknown-emscripten.md#requirements
emsdk_version=3.1.68

git clone https://github.com/emscripten-core/emsdk.git /emsdk-portable
45 changes: 26 additions & 19 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
@@ -268,7 +268,7 @@ fn test_apple(target: &str) {
"os/clock.h",
"os/lock.h",
"os/signpost.h",
// FIXME: Requires the macOS 14.4 SDK.
// FIXME(macos): Requires the macOS 14.4 SDK.
//"os/os_sync_wait_on_address.h",
"poll.h",
"pthread.h",
@@ -338,15 +338,15 @@ fn test_apple(target: &str) {
return true;
}
match ty {
// FIXME: actually a union
// FIXME(union): actually a union
"sigval" => true,

// FIXME: The size is changed in recent macOSes.
// FIXME(macos): The size is changed in recent macOSes.
"malloc_zone_t" => true,
// it is a moving target, changing through versions
// also contains bitfields members
"tcp_connection_info" => true,
// FIXME: The size is changed in recent macOSes.
// FIXME(macos): The size is changed in recent macOSes.
"malloc_introspection_t" => true,

_ => false,
@@ -358,10 +358,10 @@ fn test_apple(target: &str) {
return true;
}
match ty {
// FIXME: Requires the macOS 14.4 SDK.
// FIXME(macos): Requires the macOS 14.4 SDK.
"os_sync_wake_by_address_flags_t" | "os_sync_wait_on_address_flags_t" => true,

// FIXME: "'__uint128' undeclared" in C
// FIXME(macos): "'__uint128' undeclared" in C
"__uint128" => true,

_ => false,
@@ -377,13 +377,13 @@ fn test_apple(target: &str) {
// These OSX constants are removed in Sierra.
// https://developer.apple.com/library/content/releasenotes/General/APIDiffsMacOS10_12/Swift/Darwin.html
"KERN_KDENABLE_BG_TRACE" | "KERN_KDDISABLE_BG_TRACE" => true,
// FIXME: the value has been changed since Catalina (0xffff0000 -> 0x3fff0000).
// FIXME(macos): the value has been changed since Catalina (0xffff0000 -> 0x3fff0000).
"SF_SETTABLE" => true,

// FIXME: XCode 13.1 doesn't have it.
// FIXME(macos): XCode 13.1 doesn't have it.
"TIOCREMOTE" => true,

// FIXME: Requires the macOS 14.4 SDK.
// FIXME(macos): Requires the macOS 14.4 SDK.
"OS_SYNC_WAKE_BY_ADDRESS_NONE"
| "OS_SYNC_WAKE_BY_ADDRESS_SHARED"
| "OS_SYNC_WAIT_ON_ADDRESS_NONE"
@@ -402,19 +402,19 @@ fn test_apple(target: &str) {
// close calls the close_nocancel system call
"close" => true,

// FIXME: std removed libresolv support: https://github.com/rust-lang/rust/pull/102766
// FIXME(1.0): std removed libresolv support: https://github.com/rust-lang/rust/pull/102766
"res_init" => true,

// FIXME: remove once the target in CI is updated
// FIXME(macos): remove once the target in CI is updated
"pthread_jit_write_freeze_callbacks_np" => true,

// FIXME: ABI has been changed on recent macOSes.
// FIXME(macos): ABI has been changed on recent macOSes.
"os_unfair_lock_assert_owner" | "os_unfair_lock_assert_not_owner" => true,

// FIXME: Once the SDK get updated to Ventura's level
// FIXME(macos): Once the SDK get updated to Ventura's level
"freadlink" | "mknodat" | "mkfifoat" => true,

// FIXME: Requires the macOS 14.4 SDK.
// FIXME(macos): Requires the macOS 14.4 SDK.
"os_sync_wake_by_address_any"
| "os_sync_wake_by_address_all"
| "os_sync_wake_by_address_flags_t"
@@ -429,7 +429,7 @@ fn test_apple(target: &str) {

cfg.skip_field(move |struct_, field| {
match (struct_, field) {
// FIXME: the array size has been changed since macOS 10.15 ([8] -> [7]).
// FIXME(macos): the array size has been changed since macOS 10.15 ([8] -> [7]).
("statfs", "f_reserved") => true,
("__darwin_arm_neon_state64", "__v") => true,
// MAXPATHLEN is too big for auto-derive traits on arrays.
@@ -447,7 +447,7 @@ fn test_apple(target: &str) {

cfg.skip_field_type(move |struct_, field| {
match (struct_, field) {
// FIXME: actually a union
// FIXME(union): actually a union
("sigevent", "sigev_value") => true,
_ => false,
}
@@ -481,7 +481,7 @@ fn test_apple(target: &str) {
s if s.ends_with("_nsec") && struct_.starts_with("stat") => {
s.replace("e_nsec", "espec.tv_nsec")
}
// FIXME: sigaction actually contains a union with two variants:
// FIXME(macos): sigaction actually contains a union with two variants:
// a sa_sigaction with type: (*)(int, struct __siginfo *, void *)
// a sa_handler with type sig_t
"sa_sigaction" if struct_ == "sigaction" => "sa_handler".to_string(),
@@ -490,7 +490,7 @@ fn test_apple(target: &str) {
});

cfg.skip_roundtrip(move |s| match s {
// FIXME: this type has the wrong ABI
// FIXME(macos): this type has the wrong ABI
"max_align_t" if i686 => true,
// Can't return an array from a C function.
"uuid_t" | "vol_capabilities_set_t" => true,
@@ -597,7 +597,7 @@ fn test_openbsd(target: &str) {
return true;
}
match ty {
// FIXME: actually a union
// FIXME(union): actually a union
"sigval" => true,

_ => false,
@@ -915,6 +915,7 @@ fn test_solarish(target: &str) {
"sched.h",
"semaphore.h",
"signal.h",
"spawn.h",
"stddef.h",
"stdint.h",
"stdio.h",
@@ -3065,6 +3066,9 @@ fn test_emscripten(target: &str) {
// https://github.com/emscripten-core/emscripten/pull/14883
"SIG_IGN" => true,

// Constants present in other linuxes but not emscripten
"SI_DETHREAD" | "TRAP_PERF" => true,

// LFS64 types have been removed in Emscripten 3.1.44
// https://github.com/emscripten-core/emscripten/pull/19812
n if n.starts_with("RLIM64") => true,
@@ -4130,6 +4134,9 @@ fn test_linux(target: &str) {
// FIXME: Not currently available in headers on ARM and musl.
"NETLINK_GET_STRICT_CHK" if arm => true,

// Skip as this signal codes and trap reasons need newer headers
"SI_DETHREAD" | "TRAP_PERF" => true,

// kernel constants not available in uclibc 1.0.34
| "EXTPROC"
| "IPPROTO_BEETPH"
2 changes: 2 additions & 0 deletions libc-test/semver/illumos.txt
Original file line number Diff line number Diff line change
@@ -14,8 +14,10 @@ POSIX_FADV_NORMAL
POSIX_FADV_RANDOM
POSIX_FADV_SEQUENTIAL
POSIX_FADV_WILLNEED
POSIX_SPAWN_SETSID
posix_fadvise
posix_fallocate
posix_spawn_file_actions_addfchdir_np
pthread_attr_get_np
pthread_attr_getstackaddr
pthread_attr_setstack
16 changes: 16 additions & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
@@ -2879,7 +2879,17 @@ SIOCSMIIREG
SIOCSRARP
SIOCWANDEV
SIOGIFINDEX
SI_ASYNCIO
SI_ASYNCNL
SI_DETHREAD
SI_KERNEL
SI_LOAD_SHIFT
SI_MESGQ
SI_QUEUE
SI_SIGIO
SI_TIMER
SI_TKILL
SI_USER
SND_CNT
SND_MAX
SOCK_CLOEXEC
@@ -3359,6 +3369,12 @@ TP_STATUS_USER
TP_STATUS_VLAN_TPID_VALID
TP_STATUS_VLAN_VALID
TP_STATUS_WRONG_FORMAT
TRAP_BRANCH
TRAP_BRKPT
TRAP_HWBKPT
TRAP_PERF
TRAP_TRACE
TRAP_UNK
TUNATTACHFILTER
TUNDETACHFILTER
TUNGETFEATURES
37 changes: 37 additions & 0 deletions libc-test/semver/solarish.txt
Original file line number Diff line number Diff line change
@@ -15,6 +15,16 @@ LIO_READ
LIO_WAIT
LIO_WRITE
PIPE_BUF
POSIX_SPAWN_NOEXECERR_NP
POSIX_SPAWN_NOSIGCHLD_NP
POSIX_SPAWN_RESETIDS
POSIX_SPAWN_SETPGROUP
POSIX_SPAWN_SETSCHEDPARAM
POSIX_SPAWN_SETSCHEDULER
POSIX_SPAWN_SETSIGDEF
POSIX_SPAWN_SETSIGIGN_NP
POSIX_SPAWN_SETSIGMASK
POSIX_SPAWN_WAITPID_NP
SIGEV_PORT
SIGRTMAX
SIGRTMIN
@@ -34,5 +44,32 @@ bind
in6_pktinfo
in_pktinfo
lio_listio
posix_spawn
posix_spawn_file_actions_addchdir
posix_spawn_file_actions_addchdir_np
posix_spawn_file_actions_addclose
posix_spawn_file_actions_addclosefrom_np
posix_spawn_file_actions_adddup2
posix_spawn_file_actions_addfchdir
posix_spawn_file_actions_addopen
posix_spawn_file_actions_destroy
posix_spawn_file_actions_init
posix_spawnattr_destroy
posix_spawnattr_getflags
posix_spawnattr_getpgroup
posix_spawnattr_getschedparam
posix_spawnattr_getschedpolicy
posix_spawnattr_getsigdefault
posix_spawnattr_getsigignore_np
posix_spawnattr_getsigmask
posix_spawnattr_init
posix_spawnattr_setflags
posix_spawnattr_setpgroup
posix_spawnattr_setschedparam
posix_spawnattr_setschedpolicy
posix_spawnattr_setsigdefault
posix_spawnattr_setsigignore_np
posix_spawnattr_setsigmask
posix_spawnp
recvmsg
sendmsg
Loading