Skip to content

Commit

Permalink
Auto merge of #3268 - chenx97:mips64r6, r=JohnTitor
Browse files Browse the repository at this point in the history
add mips32r6 and mips64r6 target_arch detection

This PR introduces `"mips32r6"` and `"mips64r6"` as valid `target_arch` values, and would be the arch values used by Tier-3 targets `mipsisa32r6-unknown-linux-gnu`, `mipsisa32r6el-unknown-linux-gnu`, `mipsisa64r6-unknown-linux-gnuabi64` and `mipsisa64r6el-unknown-linux-gnuabi64`.

This PR is made for rust-lang/rust#112374.

This PR has a corresponding [MCP](rust-lang/compiler-team#632) waiting for review.

mips64r6 has the same ABIs, syscall conventions, and various magic numbers as mips64 does. So this PR just adds mips64r6 to all mips64 detection macros. Similarly, mips32r6 share their ABIs, syscall conventions and various magic with mips, so the PR just adds mips32r6 to where mips is to be detected.
  • Loading branch information
bors committed Jul 10, 2023
2 parents ca814e8 + 7d80488 commit 92e5d67
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 27 deletions.
2 changes: 1 addition & 1 deletion build.rs
Expand Up @@ -35,7 +35,7 @@ const ALLOWED_CFGS: &'static [&'static str] = &[
const CHECK_CFG_EXTRA: &'static [(&'static str, &'static [&'static str])] = &[
("target_os", &["switch", "aix", "ohos"]),
("target_env", &["illumos", "wasi", "aix", "ohos"]),
("target_arch", &["loongarch64"]),
("target_arch", &["loongarch64", "mips32r6", "mips64r6"]),
];

fn main() {
Expand Down
8 changes: 8 additions & 0 deletions src/unix/linux_like/linux/align.rs
Expand Up @@ -5,6 +5,7 @@ macro_rules! expand_align {
target_arch = "x86_64",
target_arch = "powerpc64",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "s390x",
target_arch = "sparc64",
target_arch = "aarch64",
Expand All @@ -16,6 +17,7 @@ macro_rules! expand_align {
target_arch = "x86_64",
target_arch = "powerpc64",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "s390x",
target_arch = "sparc64",
target_arch = "aarch64",
Expand Down Expand Up @@ -83,6 +85,7 @@ macro_rules! expand_align {

#[cfg_attr(all(target_pointer_width = "32",
any(target_arch = "mips",
target_arch = "mips32r6",
target_arch = "arm",
target_arch = "hexagon",
target_arch = "m68k",
Expand All @@ -93,6 +96,7 @@ macro_rules! expand_align {
repr(align(4)))]
#[cfg_attr(any(target_pointer_width = "64",
not(any(target_arch = "mips",
target_arch = "mips32r6",
target_arch = "arm",
target_arch = "hexagon",
target_arch = "m68k",
Expand All @@ -108,6 +112,7 @@ macro_rules! expand_align {

#[cfg_attr(all(target_pointer_width = "32",
any(target_arch = "mips",
target_arch = "mips32r6",
target_arch = "arm",
target_arch = "hexagon",
target_arch = "m68k",
Expand All @@ -118,6 +123,7 @@ macro_rules! expand_align {
repr(align(4)))]
#[cfg_attr(any(target_pointer_width = "64",
not(any(target_arch = "mips",
target_arch = "mips32r6",
target_arch = "arm",
target_arch = "hexagon",
target_arch = "m68k",
Expand All @@ -132,6 +138,7 @@ macro_rules! expand_align {

#[cfg_attr(all(target_pointer_width = "32",
any(target_arch = "mips",
target_arch = "mips32r6",
target_arch = "arm",
target_arch = "hexagon",
target_arch = "m68k",
Expand All @@ -142,6 +149,7 @@ macro_rules! expand_align {
repr(align(4)))]
#[cfg_attr(any(target_pointer_width = "64",
not(any(target_arch = "mips",
target_arch = "mips32r6",
target_arch = "arm",
target_arch = "hexagon",
target_arch = "m68k",
Expand Down
4 changes: 2 additions & 2 deletions src/unix/linux_like/linux/arch/mips/mod.rs
Expand Up @@ -272,15 +272,15 @@ cfg_if! {
}

cfg_if! {
if #[cfg(target_arch = "mips64",
if #[cfg(any(target_arch = "mips64", target_arch = "mips64r6"),
any(target_env = "gnu",
target_env = "uclibc"))] {
pub const RLIM_INFINITY: ::rlim_t = !0;
}
}

cfg_if! {
if #[cfg(target_arch = "mips",
if #[cfg(any(target_arch = "mips", target_arch = "mips32r6"),
any(target_env = "gnu",
target_env = "uclibc"))] {
pub const RLIM_INFINITY: ::rlim_t = 0x7fffffff;
Expand Down
5 changes: 4 additions & 1 deletion src/unix/linux_like/linux/arch/mod.rs
@@ -1,5 +1,8 @@
cfg_if! {
if #[cfg(any(target_arch = "mips", target_arch = "mips64"))] {
if #[cfg(any(target_arch = "mips",
target_arch = "mips32r6",
target_arch = "mips64",
target_arch = "mips64r6"))] {
mod mips;
pub use self::mips::*;
} else if #[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))] {
Expand Down
38 changes: 19 additions & 19 deletions src/unix/linux_like/linux/gnu/b32/mod.rs
Expand Up @@ -43,50 +43,50 @@ cfg_if! {

s! {
pub struct stat {
#[cfg(not(target_arch = "mips"))]
#[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))]
pub st_dev: ::dev_t,
#[cfg(target_arch = "mips")]
#[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
pub st_dev: ::c_ulong,

#[cfg(not(target_arch = "mips"))]
#[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))]
__pad1: ::c_short,
#[cfg(target_arch = "mips")]
#[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
st_pad1: [::c_long; 3],
pub st_ino: ::ino_t,
pub st_mode: ::mode_t,
pub st_nlink: ::nlink_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
#[cfg(not(target_arch = "mips"))]
#[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))]
pub st_rdev: ::dev_t,
#[cfg(target_arch = "mips")]
#[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
pub st_rdev: ::c_ulong,
#[cfg(not(target_arch = "mips"))]
#[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))]
__pad2: ::c_short,
#[cfg(target_arch = "mips")]
#[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
st_pad2: [::c_long; 2],
pub st_size: ::off_t,
#[cfg(target_arch = "mips")]
#[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
st_pad3: ::c_long,
#[cfg(not(target_arch = "mips"))]
#[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))]
pub st_blksize: ::blksize_t,
#[cfg(not(target_arch = "mips"))]
#[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))]
pub st_blocks: ::blkcnt_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
#[cfg(not(target_arch = "mips"))]
#[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))]
__unused4: ::c_long,
#[cfg(not(target_arch = "mips"))]
#[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))]
__unused5: ::c_long,
#[cfg(target_arch = "mips")]
#[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
pub st_blksize: ::blksize_t,
#[cfg(target_arch = "mips")]
#[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
pub st_blocks: ::blkcnt_t,
#[cfg(target_arch = "mips")]
#[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
st_pad5: [::c_long; 14],
}

Expand Down Expand Up @@ -140,12 +140,12 @@ s! {
#[cfg(target_arch = "powerpc")]
__reserved: ::__syscall_ulong_t,
pub sem_otime: ::time_t,
#[cfg(not(any(target_arch = "mips", target_arch = "powerpc")))]
#[cfg(not(any(target_arch = "mips", target_arch = "mips32r6", target_arch = "powerpc")))]
__reserved: ::__syscall_ulong_t,
#[cfg(target_arch = "powerpc")]
__reserved2: ::__syscall_ulong_t,
pub sem_ctime: ::time_t,
#[cfg(not(any(target_arch = "mips", target_arch = "powerpc")))]
#[cfg(not(any(target_arch = "mips", target_arch = "mips32r6", target_arch = "powerpc")))]
__reserved2: ::__syscall_ulong_t,
pub sem_nsems: ::__syscall_ulong_t,
__glibc_reserved3: ::__syscall_ulong_t,
Expand Down Expand Up @@ -337,7 +337,7 @@ cfg_if! {
} else if #[cfg(target_arch = "arm")] {
mod arm;
pub use self::arm::*;
} else if #[cfg(target_arch = "mips")] {
} else if #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] {
mod mips;
pub use self::mips::*;
} else if #[cfg(target_arch = "m68k")] {
Expand Down
4 changes: 3 additions & 1 deletion src/unix/linux_like/linux/gnu/b64/mod.rs
Expand Up @@ -72,6 +72,7 @@ s! {
target_arch = "aarch64",
target_arch = "loongarch64",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "powerpc64",
target_arch = "riscv64",
target_arch = "sparc64")))]
Expand All @@ -81,6 +82,7 @@ s! {
target_arch = "aarch64",
target_arch = "loongarch64",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "powerpc64",
target_arch = "riscv64",
target_arch = "sparc64")))]
Expand All @@ -105,7 +107,7 @@ cfg_if! {
} else if #[cfg(any(target_arch = "sparc64"))] {
mod sparc64;
pub use self::sparc64::*;
} else if #[cfg(any(target_arch = "mips64"))] {
} else if #[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))] {
mod mips64;
pub use self::mips64::*;
} else if #[cfg(any(target_arch = "s390x"))] {
Expand Down
15 changes: 12 additions & 3 deletions src/unix/linux_like/linux/gnu/mod.rs
Expand Up @@ -116,13 +116,17 @@ s! {
target_arch = "sparc",
target_arch = "sparc64",
target_arch = "mips",
target_arch = "mips64")))]
target_arch = "mips32r6",
target_arch = "mips64",
target_arch = "mips64r6")))]
pub c_ispeed: ::speed_t,
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
target_arch = "mips",
target_arch = "mips64")))]
target_arch = "mips32r6",
target_arch = "mips64",
target_arch = "mips64r6")))]
pub c_ospeed: ::speed_t,
}

Expand Down Expand Up @@ -954,7 +958,10 @@ pub const KEYCTL_SUPPORTS_DECRYPT: u32 = 0x02;
pub const KEYCTL_SUPPORTS_SIGN: u32 = 0x04;
pub const KEYCTL_SUPPORTS_VERIFY: u32 = 0x08;
cfg_if! {
if #[cfg(not(any(target_arch="mips", target_arch="mips64")))] {
if #[cfg(not(any(target_arch="mips",
target_arch="mips32r6",
target_arch="mips64",
target_arch = "mips64r6")))] {
pub const KEYCTL_MOVE: u32 = 30;
pub const KEYCTL_CAPABILITIES: u32 = 31;

Expand Down Expand Up @@ -1379,6 +1386,7 @@ cfg_if! {
target_arch = "arm",
target_arch = "m68k",
target_arch = "mips",
target_arch = "mips32r6",
target_arch = "powerpc",
target_arch = "sparc",
target_arch = "riscv32"))] {
Expand All @@ -1388,6 +1396,7 @@ cfg_if! {
target_arch = "aarch64",
target_arch = "powerpc64",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "s390x",
target_arch = "sparc64",
target_arch = "riscv64",
Expand Down
8 changes: 8 additions & 0 deletions src/unix/linux_like/linux/no_align.rs
Expand Up @@ -5,6 +5,7 @@ macro_rules! expand_align {
#[cfg(any(target_arch = "x86_64",
target_arch = "powerpc64",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "s390x",
target_arch = "sparc64",
target_arch = "riscv64",
Expand All @@ -16,6 +17,7 @@ macro_rules! expand_align {
#[cfg(not(any(target_arch = "x86_64",
target_arch = "powerpc64",
target_arch = "mips64",
target_arch = "mips64r6",
target_arch = "s390x",
target_arch = "sparc64",
target_arch = "riscv64",
Expand Down Expand Up @@ -68,6 +70,7 @@ macro_rules! expand_align {

pub struct pthread_mutex_t {
#[cfg(any(target_arch = "mips",
target_arch = "mips32r6",
target_arch = "arm",
target_arch = "m68k",
target_arch = "powerpc",
Expand All @@ -76,6 +79,7 @@ macro_rules! expand_align {
target_pointer_width = "32")))]
__align: [::c_long; 0],
#[cfg(not(any(target_arch = "mips",
target_arch = "mips32r6",
target_arch = "arm",
target_arch = "m68k",
target_arch = "powerpc",
Expand All @@ -88,6 +92,7 @@ macro_rules! expand_align {

pub struct pthread_rwlock_t {
#[cfg(any(target_arch = "mips",
target_arch = "mips32r6",
target_arch = "arm",
target_arch = "m68k",
target_arch = "powerpc",
Expand All @@ -96,6 +101,7 @@ macro_rules! expand_align {
target_pointer_width = "32")))]
__align: [::c_long; 0],
#[cfg(not(any(target_arch = "mips",
target_arch = "mips32r6",
target_arch = "arm",
target_arch = "m68k",
target_arch = "powerpc",
Expand All @@ -108,6 +114,7 @@ macro_rules! expand_align {

pub struct pthread_barrier_t {
#[cfg(any(target_arch = "mips",
target_arch = "mips32r6",
target_arch = "arm",
target_arch = "m68k",
target_arch = "powerpc",
Expand All @@ -116,6 +123,7 @@ macro_rules! expand_align {
target_pointer_width = "32")))]
__align: [::c_long; 0],
#[cfg(not(any(target_arch = "mips",
target_arch = "mips32r6",
target_arch = "arm",
target_arch = "m68k",
target_arch = "powerpc",
Expand Down

0 comments on commit 92e5d67

Please sign in to comment.