Skip to content
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

Fix compilation on sparc targets. #417

Merged
merged 2 commits into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ jobs:
armv5te-unknown-linux-gnueabi
s390x-unknown-linux-gnu
arm-linux-androideabi
sparc64-unknown-linux-gnu
sparcv9-sun-solaris
aarch64-linux-android
aarch64-apple-ios
- name: Install cross-compilation tools
Expand Down Expand Up @@ -111,6 +113,8 @@ jobs:
- run: cargo check --workspace --release -vv --target=armv5te-unknown-linux-gnueabi --features=all-apis
- run: cargo check --workspace --release -vv --target=s390x-unknown-linux-gnu --features=all-apis
- run: cargo check --workspace --release -vv --target=arm-linux-androideabi --features=all-apis
- run: cargo check --workspace --release -vv --target=sparc64-unknown-linux-gnu --features=all-apis
- run: cargo check --workspace --release -vv --target=sparcv9-sun-solaris --features=all-apis
- run: cargo check --workspace --release -vv --target=aarch64-apple-ios --features=all-apis
- run: cargo check --workspace --release -vv --target=aarch64-linux-android --features=all-apis

Expand Down Expand Up @@ -187,6 +191,7 @@ jobs:
- run: cargo check -Z build-std --target x86_64-unknown-openbsd --all-targets --features=all-apis
- run: cargo check -Z build-std --target mips64-openwrt-linux-musl --all-targets --features=all-apis
- run: cargo check -Z build-std --target x86_64-unknown-dragonfly --all-targets --features=all-apis
- run: cargo check -Z build-std --target sparc-unknown-linux-gnu --all-targets --features=all-apis
# Omit --all-targets on haiku because not all the tests build yet.
- run: cargo check -Z build-std --target x86_64-unknown-haiku --features=all-apis
# x86_64-uwp-windows-msvc isn't currently working.
Expand Down
14 changes: 12 additions & 2 deletions src/backend/libc/process/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,12 @@ pub enum Signal {
target_os = "solaris",
all(
any(target_os = "android", target_os = "linux"),
any(target_arch = "mips", target_arch = "mips64"),
any(
target_arch = "mips",
target_arch = "mips64",
target_arch = "sparc",
target_arch = "sparc64"
),
)
)))]
Stkflt = c::SIGSTKFLT,
Expand Down Expand Up @@ -304,7 +309,12 @@ impl Signal {
target_os = "solaris",
all(
any(target_os = "android", target_os = "linux"),
any(target_arch = "mips", target_arch = "mips64"),
any(
target_arch = "mips",
target_arch = "mips64",
target_arch = "sparc",
target_arch = "sparc64"
),
)
)))]
c::SIGSTKFLT => Some(Self::Stkflt),
Expand Down
8 changes: 8 additions & 0 deletions src/backend/libc/termios/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,8 @@ pub const B2000000: Speed = c::B2000000;

/// `B2500000`
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
Expand All @@ -779,6 +781,8 @@ pub const B2500000: Speed = c::B2500000;

/// `B3000000`
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
Expand All @@ -792,6 +796,8 @@ pub const B3000000: Speed = c::B3000000;

/// `B3500000`
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
Expand All @@ -805,6 +811,8 @@ pub const B3500000: Speed = c::B3500000;

/// `B4000000`
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
Expand Down
4 changes: 4 additions & 0 deletions src/backend/linux_raw/termios/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,15 +338,19 @@ pub const B1500000: Speed = linux_raw_sys::general::B1500000;
pub const B2000000: Speed = linux_raw_sys::general::B2000000;

/// `B2500000`
#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64",)))]
pub const B2500000: Speed = linux_raw_sys::general::B2500000;

/// `B3000000`
#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64",)))]
pub const B3000000: Speed = linux_raw_sys::general::B3000000;

/// `B3500000`
#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64",)))]
pub const B3500000: Speed = linux_raw_sys::general::B3500000;

/// `B4000000`
#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64",)))]
pub const B4000000: Speed = linux_raw_sys::general::B4000000;

/// `CSIZE`
Expand Down
16 changes: 16 additions & 0 deletions src/termios/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ pub use backend::termios::types::B1500000;
)))]
pub use backend::termios::types::B2000000;
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
Expand All @@ -55,6 +57,8 @@ pub use backend::termios::types::B2000000;
)))]
pub use backend::termios::types::B2500000;
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
Expand All @@ -66,6 +70,8 @@ pub use backend::termios::types::B2500000;
)))]
pub use backend::termios::types::B3000000;
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
Expand All @@ -77,6 +83,8 @@ pub use backend::termios::types::B3000000;
)))]
pub use backend::termios::types::B3500000;
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
Expand Down Expand Up @@ -788,6 +796,8 @@ pub fn speed_value(speed: backend::termios::types::Speed) -> Option<u32> {
)))]
backend::termios::types::B2000000 => Some(2_000_000),
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
Expand All @@ -799,6 +809,8 @@ pub fn speed_value(speed: backend::termios::types::Speed) -> Option<u32> {
)))]
backend::termios::types::B2500000 => Some(2_500_000),
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
Expand All @@ -810,6 +822,8 @@ pub fn speed_value(speed: backend::termios::types::Speed) -> Option<u32> {
)))]
backend::termios::types::B3000000 => Some(3_000_000),
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
Expand All @@ -821,6 +835,8 @@ pub fn speed_value(speed: backend::termios::types::Speed) -> Option<u32> {
)))]
backend::termios::types::B3500000 => Some(3_500_000),
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
Expand Down
8 changes: 8 additions & 0 deletions src/termios/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ pub use constants::B1500000;
)))]
pub use constants::B2000000;
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
Expand All @@ -63,6 +65,8 @@ pub use constants::B2000000;
)))]
pub use constants::B2500000;
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
Expand All @@ -74,6 +78,8 @@ pub use constants::B2500000;
)))]
pub use constants::B3000000;
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
Expand All @@ -85,6 +91,8 @@ pub use constants::B3000000;
)))]
pub use constants::B3500000;
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
Expand Down
1 change: 1 addition & 0 deletions tests/time/y2038.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#[cfg(not(all(target_env = "musl", target_pointer_width = "32")))]
#[cfg(not(all(target_os = "android", target_pointer_width = "32")))]
#[cfg(not(all(target_os = "emscripten", target_pointer_width = "32")))]
#[cfg(not(all(target_os = "linux", target_arch = "sparc")))]
#[test]
fn test_y2038() {
use rustix::time::{Secs, Timespec};
Expand Down