Skip to content

Commit

Permalink
Merge branch 'main' into quinn
Browse files Browse the repository at this point in the history
  • Loading branch information
psumbera authored Aug 12, 2024
2 parents 03919e4 + 0627e14 commit a65196f
Show file tree
Hide file tree
Showing 14 changed files with 174 additions and 67 deletions.
53 changes: 6 additions & 47 deletions .github/workflows/full_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ jobs:
contents: read # to fetch code (actions/checkout)

name: macOS
runs-on: macos-13
runs-on: macos-14
strategy:
fail-fast: true
matrix:
target: [
x86_64-apple-darwin,
aarch64-apple-darwin,
]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -140,45 +140,6 @@ jobs:
- name: Execute run-docker.sh
run: LIBC_CI=1 sh ./ci/run-docker.sh ${{ matrix.target }}

# These targets are tier 3 or otherwise need to have CI build std via -Zbuild-std.
# Because of this, only the nightly compiler can be used on these targets.
docker_linux_build_std:
permissions:
contents: read # to fetch code (actions/checkout)

if: ${{ false }} # This is currently broken
name: Docker Linux Build-Std Targets
needs: [docker_linux_tier1, style_check]
runs-on: ubuntu-22.04
strategy:
fail-fast: true
max-parallel: 12
matrix:
target: [
armv7-unknown-linux-uclibceabihf
]
steps:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: TOOLCHAIN=nightly INSTALL_RUST_SRC=1 sh ./ci/install-rust.sh
- name: Execute run-docker.sh
run: LIBC_CI=1 TOOLCHAIN=nightly LIBC_CI_ZBUILD_STD=1 sh ./ci/run-docker.sh ${{ matrix.target }}

# devkitpro's pacman needs to be connected from Docker.
docker_switch:
permissions:
contents: read # to fetch code (actions/checkout)

name: Docker Switch
needs: [docker_linux_tier1, style_check]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
run: sh ./ci/install-rust.sh
- name: Execute run-docker.sh
run: LIBC_CI=1 sh ./ci/run-docker.sh switch

build_channels_linux:
permissions:
contents: read # to fetch code (actions/checkout)
Expand Down Expand Up @@ -218,10 +179,10 @@ jobs:
max-parallel: 4
matrix:
target:
- { toolchain: stable, os: macos-13 }
- { toolchain: beta, os: macos-13 }
- { toolchain: nightly, os: macos-13 }
- { toolchain: 1.71.0, os: macos-13 }
- { toolchain: stable, os: macos-14 }
- { toolchain: beta, os: macos-14 }
- { toolchain: nightly, os: macos-14 }
- { toolchain: 1.71.0, os: macos-14 }
runs-on: ${{ matrix.target.os }}
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -275,11 +236,9 @@ jobs:
needs: [
docker_linux_tier1,
docker_linux_tier2,
#docker_linux_build_std,
macos,
windows,
style_check,
docker_switch,
build_channels_linux,
build_channels_macos,
build_channels_windows,
Expand Down
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ targets = [
"armv7-wrs-vxworks-eabihf",
"armv7r-none-eabi",
"armv7r-none-eabihf",
"hexagon-unknown-linux-musl",
# FIXME(hexagon): excluded due to duplicate symbol errors
# "hexagon-unknown-linux-musl",
"i586-pc-windows-msvc",
"i586-unknown-linux-gnu",
"i586-unknown-linux-musl",
Expand Down
5 changes: 2 additions & 3 deletions ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ x86_64-unknown-redox \

RUST_APPLE_TARGETS="\
aarch64-apple-ios \
x86_64-apple-darwin \
x86_64-apple-ios \
"

RUST_NIGHTLY_APPLE_TARGETS="\
Expand Down Expand Up @@ -211,6 +209,8 @@ for TARGET in $TARGETS; do
done

# Targets which are not available via rustup and must be built with -Zbuild-std
# FIXME(hexagon): hexagon-unknown-linux-musl should be tested but currently has
# duplicate symbol errors from `compiler_builtins`.
RUST_LINUX_NO_CORE_TARGETS="\
aarch64-pc-windows-msvc \
aarch64-unknown-freebsd \
Expand All @@ -223,7 +223,6 @@ armebv7r-none-eabihf \
armv7-wrs-vxworks-eabihf \
armv7r-none-eabi \
armv7r-none-eabihf \
hexagon-unknown-linux-musl \
i586-pc-windows-msvc \
i686-pc-windows-msvc \
i686-unknown-haiku \
Expand Down
5 changes: 5 additions & 0 deletions libc-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,8 @@ harness = true
name = "semver"
path = "test/semver.rs"
harness = false

[[test]]
name = "primitive_types"
path = "test/primitive_types.rs"
harness = true
22 changes: 20 additions & 2 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ fn test_apple(target: &str) {
"tcp_connection_info" => true,
// FIXME: The size is changed in recent macOSes.
"malloc_introspection_t" => true,
// sonoma changes the padding `rmx_filler` field.
"rt_metrics" => true,

_ => false,
}
Expand Down Expand Up @@ -1633,6 +1635,8 @@ fn test_android(target: &str) {
"linux/netfilter/nfnetlink_log.h",
"linux/netfilter/nfnetlink_queue.h",
"linux/netfilter/nf_tables.h",
"linux/netfilter_arp.h",
"linux/netfilter_bridge.h",
"linux/netfilter_ipv4.h",
"linux/netfilter_ipv6.h",
"linux/netfilter_ipv6/ip6_tables.h",
Expand Down Expand Up @@ -2215,6 +2219,12 @@ fn test_freebsd(target: &str) {
// should've been used anywhere anyway.
"TDF_UNUSED23" => true,

// Removed in FreeBSD 15
"TDF_CANSWAP" | "TDF_SWAPINREQ" => true,

// Unaccessible in FreeBSD 15
"TDI_SWAPPED" | "P_SWAPPINGOUT" | "P_SWAPPINGIN" => true,

// Removed in FreeBSD 14 (git a6b55ee6be1)
"IFF_KNOWSEPOCH" => true,

Expand Down Expand Up @@ -3434,6 +3444,8 @@ fn test_linux(target: &str) {
"linux/netfilter/nfnetlink_log.h",
"linux/netfilter/nfnetlink_queue.h",
"linux/netfilter/nf_tables.h",
"linux/netfilter_arp.h",
"linux/netfilter_bridge.h",
"linux/netfilter_ipv4.h",
"linux/netfilter_ipv6.h",
"linux/netfilter_ipv6/ip6_tables.h",
Expand Down Expand Up @@ -3950,9 +3962,15 @@ fn test_linux(target: &str) {
| "MINSIGSTKSZ"
if gnu => true,

// FIXME: Linux >= 5.16 changed its value:
// FIXME: Linux >= 5.10:
// https://github.com/torvalds/linux/commit/d25e2e9388eda61b6e298585024ee3355f50c493
"NF_INET_INGRESS" if musl => true,

// FIXME: Linux >= 5.16:
// https://github.com/torvalds/linux/commit/42df6e1d221dddc0f2acf2be37e68d553ad65f96
"NF_NETDEV_NUMHOOKS" => true,
"NF_NETDEV_EGRESS" if musl || sparc64 => true,
// value changed
"NF_NETDEV_NUMHOOKS" if musl || sparc64 => true,

// FIXME: requires Linux >= 5.6:
| "RESOLVE_BENEATH"
Expand Down
24 changes: 24 additions & 0 deletions libc-test/semver/android.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1644,8 +1644,29 @@ NFULNL_COPY_PACKET
NFULNL_MSG_CONFIG
NFULNL_MSG_PACKET
NF_ACCEPT
NF_ARP
NF_ARP_FORWARD
NF_ARP_IN
NF_ARP_NUMHOOKS
NF_ARP_OUT
NF_BR_BROUTING
NF_BR_FORWARD
NF_BR_LOCAL_IN
NF_BR_LOCAL_OUT
NF_BR_NUMHOOKS
NF_BR_POST_ROUTING
NF_BR_PRE_ROUTING
NF_BR_PRI_BRNF
NF_BR_PRI_FILTER_BRIDGED
NF_BR_PRI_FILTER_OTHER
NF_BR_PRI_FIRST
NF_BR_PRI_LAST
NF_BR_PRI_NAT_DST_BRIDGED
NF_BR_PRI_NAT_DST_OTHER
NF_BR_PRI_NAT_SRC
NF_DROP
NF_INET_FORWARD
NF_INET_INGRESS
NF_INET_LOCAL_IN
NF_INET_LOCAL_OUT
NF_INET_NUMHOOKS
Expand All @@ -1667,6 +1688,7 @@ NF_IP6_PRI_MANGLE
NF_IP6_PRI_NAT_DST
NF_IP6_PRI_NAT_SRC
NF_IP6_PRI_RAW
NF_IP6_PRI_RAW_BEFORE_DEFRAG
NF_IP6_PRI_SECURITY
NF_IP6_PRI_SELINUX_FIRST
NF_IP6_PRI_SELINUX_LAST
Expand All @@ -1687,10 +1709,12 @@ NF_IP_PRI_MANGLE
NF_IP_PRI_NAT_DST
NF_IP_PRI_NAT_SRC
NF_IP_PRI_RAW
NF_IP_PRI_RAW_BEFORE_DEFRAG
NF_IP_PRI_SECURITY
NF_IP_PRI_SELINUX_FIRST
NF_IP_PRI_SELINUX_LAST
NF_MAX_VERDICT
NF_NETDEV_EGRESS
NF_NETDEV_INGRESS
NF_NETDEV_NUMHOOKS
NF_QUEUE
Expand Down
24 changes: 24 additions & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1693,8 +1693,29 @@ NFULNL_COPY_PACKET
NFULNL_MSG_CONFIG
NFULNL_MSG_PACKET
NF_ACCEPT
NF_ARP
NF_ARP_FORWARD
NF_ARP_IN
NF_ARP_NUMHOOKS
NF_ARP_OUT
NF_BR_BROUTING
NF_BR_FORWARD
NF_BR_LOCAL_IN
NF_BR_LOCAL_OUT
NF_BR_NUMHOOKS
NF_BR_POST_ROUTING
NF_BR_PRE_ROUTING
NF_BR_PRI_BRNF
NF_BR_PRI_FILTER_BRIDGED
NF_BR_PRI_FILTER_OTHER
NF_BR_PRI_FIRST
NF_BR_PRI_LAST
NF_BR_PRI_NAT_DST_BRIDGED
NF_BR_PRI_NAT_DST_OTHER
NF_BR_PRI_NAT_SRC
NF_DROP
NF_INET_FORWARD
NF_INET_INGRESS
NF_INET_LOCAL_IN
NF_INET_LOCAL_OUT
NF_INET_NUMHOOKS
Expand All @@ -1716,6 +1737,7 @@ NF_IP6_PRI_MANGLE
NF_IP6_PRI_NAT_DST
NF_IP6_PRI_NAT_SRC
NF_IP6_PRI_RAW
NF_IP6_PRI_RAW_BEFORE_DEFRAG
NF_IP6_PRI_SECURITY
NF_IP6_PRI_SELINUX_FIRST
NF_IP6_PRI_SELINUX_LAST
Expand All @@ -1736,10 +1758,12 @@ NF_IP_PRI_MANGLE
NF_IP_PRI_NAT_DST
NF_IP_PRI_NAT_SRC
NF_IP_PRI_RAW
NF_IP_PRI_RAW_BEFORE_DEFRAG
NF_IP_PRI_SECURITY
NF_IP_PRI_SELINUX_FIRST
NF_IP_PRI_SELINUX_LAST
NF_MAX_VERDICT
NF_NETDEV_EGRESS
NF_QUEUE
NF_REPEAT
NF_STOLEN
Expand Down
15 changes: 15 additions & 0 deletions libc-test/test/primitive_types.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use std::any::TypeId;

macro_rules! ok {
($($t:ident)*) => {$(
assert!(TypeId::of::<libc::$t>() == TypeId::of::<ffi::$t>(),
"{} is wrong", stringify!($t));
)*}
}

#[test]
fn same() {
use std::ffi;
ok!(c_char c_schar c_uchar c_short c_ushort c_int c_uint c_long c_ulong
c_longlong c_ulonglong c_float c_double);
}
7 changes: 6 additions & 1 deletion src/fixed_width_ints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub type uint32_t = u32;
pub type uint64_t = u64;

cfg_if! {
if #[cfg(all(target_arch = "aarch64", not(target_os = "windows")))] {
if #[cfg(all(target_arch = "aarch64", not(any(target_os = "windows", target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))))] {
// This introduces partial support for FFI with __int128 and
// equivalent types on platforms where Rust's definition is validated
// to match the standard C ABI of that platform.
Expand Down Expand Up @@ -92,5 +92,10 @@ cfg_if! {

// static_assert_eq!(core::mem::size_of::<__uint128_t>(), _SIZE_128);
// static_assert_eq!(core::mem::align_of::<__uint128_t>(), _ALIGN_128);
} else if #[cfg(all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos")))] {
/// /// C `__int128_t`
pub type __int128_t = i128;
/// /// C `__uint128_t`
pub type __uint128_t = u128;
}
}
8 changes: 1 addition & 7 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,7 @@ s! {
pub rmx_rtt: u32,
pub rmx_rttvar: u32,
pub rmx_pksent: u32,
pub rmx_state: u32,
pub rmx_filler: [u32; 3],
pub rmx_filler: [u32; 4],
}

pub struct rt_msghdr {
Expand Down Expand Up @@ -6296,7 +6295,6 @@ extern "C" {
out_processor_infoCnt: *mut mach_msg_type_number_t,
) -> ::kern_return_t;

pub static mut mach_task_self_: ::mach_port_t;
pub fn task_for_pid(
host: ::mach_port_t,
pid: ::pid_t,
Expand Down Expand Up @@ -6413,10 +6411,6 @@ extern "C" {
) -> ::c_int;
}

pub unsafe fn mach_task_self() -> ::mach_port_t {
mach_task_self_
}

cfg_if! {
if #[cfg(target_os = "macos")] {
extern "C" {
Expand Down
Loading

0 comments on commit a65196f

Please sign in to comment.