Skip to content

Commit d372714

Browse files
committed
support for mips32r6 as a target_arch value
1 parent a132b3e commit d372714

File tree

16 files changed

+29
-14
lines changed

16 files changed

+29
-14
lines changed

compiler/rustc_codegen_gcc/example/alloc_system.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#[cfg(any(target_arch = "x86",
1111
target_arch = "arm",
1212
target_arch = "mips",
13+
target_arch = "mips32r6",
1314
target_arch = "powerpc",
1415
target_arch = "powerpc64"))]
1516
const MIN_ALIGN: usize = 8;

compiler/rustc_codegen_ssa/src/back/metadata.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
193193
}
194194
"x86" => Architecture::I386,
195195
"s390x" => Architecture::S390x,
196-
"mips" => Architecture::Mips,
196+
"mips" | "mips32r6" => Architecture::Mips,
197197
"mips64" | "mips64r6" => Architecture::Mips64,
198198
"x86_64" => {
199199
if sess.target.pointer_width == 32 {

compiler/rustc_codegen_ssa/src/target_features.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ pub fn supported_target_features(sess: &Session) -> &'static [(&'static str, Opt
321321
"aarch64" => AARCH64_ALLOWED_FEATURES,
322322
"x86" | "x86_64" => X86_ALLOWED_FEATURES,
323323
"hexagon" => HEXAGON_ALLOWED_FEATURES,
324-
"mips" | "mips64" | "mips64r6" => MIPS_ALLOWED_FEATURES,
324+
"mips" | "mips32r6" | "mips64" | "mips64r6" => MIPS_ALLOWED_FEATURES,
325325
"powerpc" | "powerpc64" => POWERPC_ALLOWED_FEATURES,
326326
"riscv32" | "riscv64" => RISCV_ALLOWED_FEATURES,
327327
"wasm32" | "wasm64" => WASM_ALLOWED_FEATURES,

compiler/rustc_target/src/abi/call/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ impl<'a, Ty> FnAbi<'a, Ty> {
693693
"avr" => avr::compute_abi_info(self),
694694
"loongarch64" => loongarch::compute_abi_info(cx, self),
695695
"m68k" => m68k::compute_abi_info(self),
696-
"mips" => mips::compute_abi_info(cx, self),
696+
"mips" | "mips32r6" => mips::compute_abi_info(cx, self),
697697
"mips64" | "mips64r6" => mips64::compute_abi_info(cx, self),
698698
"powerpc" => powerpc::compute_abi_info(self),
699699
"powerpc64" => powerpc64::compute_abi_info(cx, self),

compiler/rustc_target/src/asm/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ impl FromStr for InlineAsmArch {
238238
"powerpc64" => Ok(Self::PowerPC64),
239239
"hexagon" => Ok(Self::Hexagon),
240240
"loongarch64" => Ok(Self::LoongArch64),
241-
"mips" => Ok(Self::Mips),
241+
"mips" | "mips32r6" => Ok(Self::Mips),
242242
"mips64" | "mips64r6" => Ok(Self::Mips64),
243243
"s390x" => Ok(Self::S390x),
244244
"spirv" => Ok(Self::SpirV),

compiler/rustc_target/src/spec/mipsisa32r6_unknown_linux_gnu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub fn target() -> Target {
66
llvm_target: "mipsisa32r6-unknown-linux-gnu".into(),
77
pointer_width: 32,
88
data_layout: "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".into(),
9-
arch: "mips".into(),
9+
arch: "mips32r6".into(),
1010
options: TargetOptions {
1111
endian: Endian::Big,
1212
cpu: "mips32r6".into(),

compiler/rustc_target/src/spec/mipsisa32r6el_unknown_linux_gnu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub fn target() -> Target {
55
llvm_target: "mipsisa32r6el-unknown-linux-gnu".into(),
66
pointer_width: 32,
77
data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".into(),
8-
arch: "mips".into(),
8+
arch: "mips32r6".into(),
99

1010
options: TargetOptions {
1111
cpu: "mips32r6".into(),

library/std/src/os/linux/raw.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ mod arch {
9494
}
9595
}
9696

97-
#[cfg(target_arch = "mips")]
97+
#[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
9898
mod arch {
9999
use crate::os::raw::{c_long, c_ulong};
100100

library/std/src/sync/mpmc/utils.rs

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ use crate::ops::{Deref, DerefMut};
3535
any(
3636
target_arch = "arm",
3737
target_arch = "mips",
38+
target_arch = "mips32r6",
3839
target_arch = "mips64",
3940
target_arch = "mips64r6",
4041
target_arch = "riscv64",
@@ -60,6 +61,7 @@ use crate::ops::{Deref, DerefMut};
6061
target_arch = "powerpc64",
6162
target_arch = "arm",
6263
target_arch = "mips",
64+
target_arch = "mips32r6",
6365
target_arch = "mips64",
6466
target_arch = "mips64r6",
6567
target_arch = "riscv64",

library/std/src/sys/common/alloc.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use crate::ptr;
99
target_arch = "arm",
1010
target_arch = "m68k",
1111
target_arch = "mips",
12+
target_arch = "mips32r6",
1213
target_arch = "powerpc",
1314
target_arch = "powerpc64",
1415
target_arch = "sparc",

library/std/src/sys/personality/gcc.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ const UNWIND_DATA_REG: (i32, i32) = (0, 1); // R0, R1 / X0, X1
5959
#[cfg(target_arch = "m68k")]
6060
const UNWIND_DATA_REG: (i32, i32) = (0, 1); // D0, D1
6161

62-
#[cfg(any(target_arch = "mips", target_arch = "mips64", target_arch = "mips64r6"))]
62+
#[cfg(any(
63+
target_arch = "mips",
64+
target_arch = "mips32r6",
65+
target_arch = "mips64",
66+
target_arch = "mips64r6"
67+
))]
6368
const UNWIND_DATA_REG: (i32, i32) = (4, 5); // A0, A1
6469

6570
#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]

library/unwind/src/libunwind.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub const unwinder_private_data_size: usize = 5;
5151
#[cfg(target_arch = "m68k")]
5252
pub const unwinder_private_data_size: usize = 2;
5353

54-
#[cfg(target_arch = "mips")]
54+
#[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
5555
pub const unwinder_private_data_size: usize = 2;
5656

5757
#[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))]

src/bootstrap/lib.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,12 @@ const EXTRA_CHECK_CFGS: &[(Option<Mode>, &'static str, Option<&[&'static str]>)]
133133
/* Extra values not defined in the built-in targets yet, but used in std */
134134
(Some(Mode::Std), "target_env", Some(&["libnx"])),
135135
// (Some(Mode::Std), "target_os", Some(&[])),
136-
// #[cfg(bootstrap)] mips64r6
137-
(Some(Mode::Std), "target_arch", Some(&["asmjs", "spirv", "nvptx", "xtensa", "mips64r6"])),
136+
// #[cfg(bootstrap)] mips32r6, mips64r6
137+
(
138+
Some(Mode::Std),
139+
"target_arch",
140+
Some(&["asmjs", "spirv", "nvptx", "xtensa", "mips32r6", "mips64r6"]),
141+
),
138142
/* Extra names used by dependencies */
139143
// FIXME: Used by serde_json, but we should not be triggering on external dependencies.
140144
(Some(Mode::Rustc), "no_btreemap_remove_entry", None),

src/librustdoc/clean/cfg.rs

+1
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ impl<'a> fmt::Display for Display<'a> {
520520
"loongarch64" => "LoongArch LA64",
521521
"m68k" => "M68k",
522522
"mips" => "MIPS",
523+
"mips32r6" => "MIPS Release 6",
523524
"mips64" => "MIPS-64",
524525
"mips64r6" => "MIPS-64 Release 6",
525526
"msp430" => "MSP430",

src/tools/miri/src/shims/foreign_items.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
4545
// List taken from `library/std/src/sys/common/alloc.rs`.
4646
// This list should be kept in sync with the one from libstd.
4747
let min_align = match this.tcx.sess.target.arch.as_ref() {
48-
"x86" | "arm" | "mips" | "powerpc" | "powerpc64" | "asmjs" | "wasm32" => 8,
49-
"x86_64" | "aarch64" | "mips64" | "mips64r6" | "s390x" | "sparc64" | "loongarch64" => 16,
48+
"x86" | "arm" | "mips" | "mips32r6" | "powerpc" | "powerpc64" | "asmjs" | "wasm32" => 8,
49+
"x86_64" | "aarch64" | "mips64" | "mips64r6" | "s390x" | "sparc64" | "loongarch64" =>
50+
16,
5051
arch => bug!("unsupported target architecture for malloc: `{}`", arch),
5152
};
5253
// Windows always aligns, even small allocations.

tests/ui/check-cfg/compact-values.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ warning: unexpected `cfg` condition value
44
LL | #[cfg(target(os = "linux", arch = "X"))]
55
| ^^^^^^^^^^
66
|
7-
= note: expected values for `target_arch` are: `aarch64`, `arm`, `avr`, `bpf`, `hexagon`, `loongarch64`, `m68k`, `mips`, `mips64`, `mips64r6`, `msp430`, `nvptx64`, `powerpc`, `powerpc64`, `riscv32`, `riscv64`, `s390x`, `sparc`, `sparc64`, `wasm32`, `wasm64`, `x86`, `x86_64`
7+
= note: expected values for `target_arch` are: `aarch64`, `arm`, `avr`, `bpf`, `hexagon`, `loongarch64`, `m68k`, `mips`, `mips32r6`, `mips64`, `mips64r6`, `msp430`, `nvptx64`, `powerpc`, `powerpc64`, `riscv32`, `riscv64`, `s390x`, `sparc`, `sparc64`, `wasm32`, `wasm64`, `x86`, `x86_64`
88
= note: `#[warn(unexpected_cfgs)]` on by default
99

1010
warning: 1 warning emitted

0 commit comments

Comments
 (0)