From 5944bde3c3a383543f8b54348b9c9412ad217967 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 19 Mar 2024 12:36:59 -0700 Subject: [PATCH] Fix compilation errors on armv6k-nintendo-3ds. (#1027) --- .github/workflows/main.yml | 2 ++ src/backend/libc/io/errno.rs | 50 +++++++++++++++++++++++++++++++++ src/backend/libc/io/syscalls.rs | 9 ++++-- src/io/dup.rs | 1 + src/io/ioctl.rs | 2 +- src/io/read_write.rs | 6 ++-- src/ioctl/mod.rs | 1 + 7 files changed, 65 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cdfe2f129..13d2ee898 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -222,6 +222,8 @@ jobs: #- run: cargo check -Z build-std --target=riscv32imc-esp-espidf --features=all-apis - run: cargo check -Z build-std --target=aarch64-unknown-nto-qnx710 --features=all-apis - run: cargo check -Z build-std --target=x86_64-pc-nto-qnx710 --features=all-apis + # Temporarily disable --features=all-apis, which doesn't build yet. + - run: cargo check -Z build-std --target=armv6k-nintendo-3ds # Temporarily disable armv7-sony-vita-newlibeabihf due to std using SOMAXCONN. #- run: cargo check -Z build-std --target=armv7-sony-vita-newlibeabihf --features=all-apis # `std` doesn't appear to build on AIX yet, so test in `no_std` mode. diff --git a/src/backend/libc/io/errno.rs b/src/backend/libc/io/errno.rs index 805ea6799..fb604a882 100644 --- a/src/backend/libc/io/errno.rs +++ b/src/backend/libc/io/errno.rs @@ -52,6 +52,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -76,6 +77,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -91,6 +93,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -107,6 +110,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -123,6 +127,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -136,6 +141,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -149,6 +155,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -173,6 +180,7 @@ impl Errno { windows, target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -186,6 +194,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -209,6 +218,7 @@ impl Errno { target_os = "android", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "vita", target_os = "wasi", @@ -234,6 +244,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "nto", @@ -268,6 +279,7 @@ impl Errno { target_os = "android", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "nto", @@ -317,6 +329,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "nto", @@ -332,6 +345,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "nto", @@ -347,6 +361,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "nto", @@ -362,6 +377,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "nto", @@ -375,6 +391,7 @@ impl Errno { windows, target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -387,6 +404,7 @@ impl Errno { windows, target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -399,6 +417,7 @@ impl Errno { windows, target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -411,6 +430,7 @@ impl Errno { windows, target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -424,6 +444,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -437,6 +458,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -450,6 +472,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "l4re", target_os = "vita", target_os = "wasi", @@ -462,6 +485,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -475,6 +499,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -487,6 +512,7 @@ impl Errno { windows, target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -503,6 +529,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "nto", @@ -531,6 +558,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "nto", @@ -558,6 +586,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -576,6 +605,7 @@ impl Errno { windows, target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -608,6 +638,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "nto", @@ -629,6 +660,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "nto", @@ -652,6 +684,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -665,6 +698,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -705,6 +739,7 @@ impl Errno { windows, target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "vita", target_os = "wasi" )))] @@ -727,6 +762,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "nto", @@ -759,6 +795,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -828,6 +865,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -838,6 +876,7 @@ impl Errno { #[cfg(not(any( target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "l4re", target_os = "vita", target_os = "wasi" @@ -851,6 +890,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "nto", @@ -864,6 +904,7 @@ impl Errno { windows, target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -879,6 +920,7 @@ impl Errno { target_os = "android", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "nto", @@ -896,6 +938,7 @@ impl Errno { /// `ESHUTDOWN` #[cfg(not(any( target_os = "espidf", + target_os = "horizon", target_os = "l4re", target_os = "vita", target_os = "wasi" @@ -905,6 +948,7 @@ impl Errno { #[cfg(not(any( target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "l4re", target_os = "vita", target_os = "wasi" @@ -923,6 +967,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -938,6 +983,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -973,6 +1019,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "nto", @@ -986,6 +1033,7 @@ impl Errno { windows, target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", @@ -996,6 +1044,7 @@ impl Errno { #[cfg(not(any( target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "l4re", target_os = "vita", target_os = "wasi" @@ -1013,6 +1062,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "l4re", target_os = "vita", diff --git a/src/backend/libc/io/syscalls.rs b/src/backend/libc/io/syscalls.rs index e28e6befc..9c8638f75 100644 --- a/src/backend/libc/io/syscalls.rs +++ b/src/backend/libc/io/syscalls.rs @@ -20,7 +20,7 @@ use crate::ioctl::{IoctlOutput, RawOpcode}; use core::cmp::min; #[cfg(all(feature = "fs", feature = "net"))] use libc_errno::errno; -#[cfg(not(target_os = "espidf"))] +#[cfg(not(any(target_os = "espidf", target_os = "horizon")))] use { crate::backend::MAX_IOV, crate::io::{IoSlice, IoSliceMut}, @@ -71,7 +71,7 @@ pub(crate) fn pwrite(fd: BorrowedFd<'_>, buf: &[u8], offset: u64) -> io::Result< unsafe { ret_usize(c::pwrite(borrowed_fd(fd), buf.as_ptr().cast(), len, offset)) } } -#[cfg(not(target_os = "espidf"))] +#[cfg(not(any(target_os = "espidf", target_os = "horizon")))] pub(crate) fn readv(fd: BorrowedFd<'_>, bufs: &mut [IoSliceMut<'_>]) -> io::Result { unsafe { ret_usize(c::readv( @@ -82,7 +82,7 @@ pub(crate) fn readv(fd: BorrowedFd<'_>, bufs: &mut [IoSliceMut<'_>]) -> io::Resu } } -#[cfg(not(target_os = "espidf"))] +#[cfg(not(any(target_os = "espidf", target_os = "horizon")))] pub(crate) fn writev(fd: BorrowedFd<'_>, bufs: &[IoSlice<'_>]) -> io::Result { unsafe { ret_usize(c::writev( @@ -96,6 +96,7 @@ pub(crate) fn writev(fd: BorrowedFd<'_>, bufs: &[IoSlice<'_>]) -> io::Result, new: &mut OwnedFd) -> io::Result<()> { target_os = "dragonfly", target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "nto", target_os = "redox", target_os = "vita", diff --git a/src/io/dup.rs b/src/io/dup.rs index 46fb38ad3..5d959c125 100644 --- a/src/io/dup.rs +++ b/src/io/dup.rs @@ -114,6 +114,7 @@ pub fn dup2(fd: Fd, new: &mut OwnedFd) -> io::Result<()> { #[cfg(not(any( target_os = "aix", target_os = "espidf", + target_os = "horizon", target_os = "nto", target_os = "vita", target_os = "wasi" diff --git a/src/io/ioctl.rs b/src/io/ioctl.rs index 99dec067d..e83e692a3 100644 --- a/src/io/ioctl.rs +++ b/src/io/ioctl.rs @@ -65,7 +65,7 @@ pub fn ioctl_fionbio(fd: Fd, value: bool) -> io::Result<()> { /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=ioctl&sektion=2#GENERIC%09IOCTLS /// [NetBSD]: https://man.netbsd.org/ioctl.2#GENERIC%20IOCTLS /// [OpenBSD]: https://man.openbsd.org/ioctl.2#GENERIC_IOCTLS -#[cfg(not(any(target_os = "espidf", target_os = "vita")))] +#[cfg(not(any(target_os = "espidf", target_os = "horizon", target_os = "vita")))] #[inline] #[doc(alias = "FIONREAD")] pub fn ioctl_fionread(fd: Fd) -> io::Result { diff --git a/src/io/read_write.rs b/src/io/read_write.rs index 2ed9dd716..9ebbd7a12 100644 --- a/src/io/read_write.rs +++ b/src/io/read_write.rs @@ -177,7 +177,7 @@ pub fn pwrite(fd: Fd, buf: &[u8], offset: u64) -> io::Result { /// [OpenBSD]: https://man.openbsd.org/readv.2 /// [DragonFly BSD]: https://man.dragonflybsd.org/?command=readv§ion=2 /// [illumos]: https://illumos.org/man/2/readv -#[cfg(not(target_os = "espidf"))] +#[cfg(not(any(target_os = "espidf", target_os = "horizon")))] #[inline] pub fn readv(fd: Fd, bufs: &mut [IoSliceMut<'_>]) -> io::Result { backend::io::syscalls::readv(fd.as_fd(), bufs) @@ -203,7 +203,7 @@ pub fn readv(fd: Fd, bufs: &mut [IoSliceMut<'_>]) -> io::Result /// [OpenBSD]: https://man.openbsd.org/writev.2 /// [DragonFly BSD]: https://man.dragonflybsd.org/?command=writev§ion=2 /// [illumos]: https://illumos.org/man/2/writev -#[cfg(not(target_os = "espidf"))] +#[cfg(not(any(target_os = "espidf", target_os = "horizon")))] #[inline] pub fn writev(fd: Fd, bufs: &[IoSlice<'_>]) -> io::Result { backend::io::syscalls::writev(fd.as_fd(), bufs) @@ -229,6 +229,7 @@ pub fn writev(fd: Fd, bufs: &[IoSlice<'_>]) -> io::Result { #[cfg(not(any( target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "nto", target_os = "redox", target_os = "solaris", @@ -263,6 +264,7 @@ pub fn preadv(fd: Fd, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io: #[cfg(not(any( target_os = "espidf", target_os = "haiku", + target_os = "horizon", target_os = "nto", target_os = "redox", target_os = "solaris", diff --git a/src/ioctl/mod.rs b/src/ioctl/mod.rs index 494cdc829..30646efe9 100644 --- a/src/ioctl/mod.rs +++ b/src/ioctl/mod.rs @@ -332,6 +332,7 @@ type _RawOpcode = c::c_int; bsd, target_os = "redox", target_os = "haiku", + target_os = "horizon", target_os = "hurd", target_os = "vita" ))]