Auto merge of #135074 - wzssyqa:mips-mti, r=oli-obk · rust-lang/rust@7270e73 (original) (raw)

12 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -1926,6 +1926,8 @@ supported_targets! {
1926 1926 ("mipsel-sony-psp", mipsel_sony_psp),
1927 1927 ("mipsel-sony-psx", mipsel_sony_psx),
1928 1928 ("mipsel-unknown-none", mipsel_unknown_none),
1929 +("mips-mti-none-elf", mips_mti_none_elf),
1930 +("mipsel-mti-none-elf", mipsel_mti_none_elf),
1929 1931 ("thumbv4t-none-eabi", thumbv4t_none_eabi),
1930 1932 ("armv4t-none-eabi", armv4t_none_eabi),
1931 1933 ("thumbv5te-none-eabi", thumbv5te_none_eabi),
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
1 +use crate::abi::Endian;
2 +use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
3 +
4 +pub(crate) fn target() -> Target {
5 +Target {
6 +data_layout: "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".into(),
7 +llvm_target: "mips".into(),
8 +metadata: crate::spec::TargetMetadata {
9 +description: Some("MIPS32r2 BE Baremetal Softfloat".into()),
10 +tier: Some(3),
11 +host_tools: Some(false),
12 +std: None, // ?
13 +},
14 +pointer_width: 32,
15 +arch: "mips".into(),
16 +
17 +options: TargetOptions {
18 +vendor: "mti".into(),
19 +linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
20 +linker: Some("rust-lld".into()),
21 +endian: Endian::Big,
22 +cpu: "mips32r2".into(),
23 +
24 +max_atomic_width: Some(32),
25 +
26 +features: "+mips32r2,+soft-float,+noabicalls".into(),
27 +executables: true,
28 +panic_strategy: PanicStrategy::Abort,
29 +relocation_model: RelocModel::Static,
30 +emit_debug_gdb_scripts: false,
31 +eh_frame_header: false,
32 +singlethread: true,
33 + ..Default::default()
34 +},
35 +}
36 +}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
1 +use crate::abi::Endian;
2 +use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
3 +
4 +pub(crate) fn target() -> Target {
5 +Target {
6 +data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".into(),
7 +llvm_target: "mipsel".into(),
8 +metadata: crate::spec::TargetMetadata {
9 +description: Some("MIPS32r2 LE Baremetal Softfloat".into()),
10 +tier: Some(3),
11 +host_tools: Some(false),
12 +std: None, // ?
13 +},
14 +pointer_width: 32,
15 +arch: "mips".into(),
16 +
17 +options: TargetOptions {
18 +vendor: "mti".into(),
19 +linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
20 +linker: Some("rust-lld".into()),
21 +endian: Endian::Little,
22 +cpu: "mips32r2".into(),
23 +
24 +max_atomic_width: Some(32),
25 +
26 +features: "+mips32r2,+soft-float,+noabicalls".into(),
27 +executables: true,
28 +panic_strategy: PanicStrategy::Abort,
29 +relocation_model: RelocModel::Static,
30 +emit_debug_gdb_scripts: false,
31 +eh_frame_header: false,
32 +singlethread: true,
33 + ..Default::default()
34 +},
35 +}
36 +}
Original file line number Diff line number Diff line change
@@ -62,6 +62,7 @@
62 62 - [m68k-unknown-linux-gnu](platform-support/m68k-unknown-linux-gnu.md)
63 63 - [mips64-openwrt-linux-musl](platform-support/mips64-openwrt-linux-musl.md)
64 64 - [mipsel-sony-psx](platform-support/mipsel-sony-psx.md)
65 +- [mips\*-mti-none-elf](platform-support/mips-mti-none-elf.md)
65 66 - [mipsisa\*r6\*-unknown-linux-gnu\*](platform-support/mips-release-6.md)
66 67 - [nvptx64-nvidia-cuda](platform-support/nvptx64-nvidia-cuda.md)
67 68 - [powerpc-unknown-openbsd](platform-support/powerpc-unknown-openbsd.md)
Original file line number Diff line number Diff line change
@@ -332,6 +332,8 @@ target | std host notes
332 332 `mipsel-unknown-linux-uclibc` | ✓ MIPS (LE) Linux with uClibc
333 333 [`mipsel-unknown-netbsd`](platform-support/netbsd.md) | ✓ 32-bit MIPS (LE), requires mips32 cpu support
334 334 `mipsel-unknown-none` | * Bare MIPS (LE) softfloat
335 +[`mips-mti-none-elf`](platform-support/mips-mti-none-elf.md) | * Bare MIPS32r2 (BE) softfloat
336 +[`mipsel-mti-none-elf`](platform-support/mips-mti-none-elf.md) | * Bare MIPS32r2 (LE) softfloat
335 337 [`mipsisa32r6-unknown-linux-gnu`](platform-support/mips-release-6.md) | ? 32-bit MIPS Release 6 Big Endian
336 338 [`mipsisa32r6el-unknown-linux-gnu`](platform-support/mips-release-6.md) | ? 32-bit MIPS Release 6 Little Endian
337 339 [`mipsisa64r6-unknown-linux-gnuabi64`](platform-support/mips-release-6.md) | ? 64-bit MIPS Release 6 Big Endian
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
1 +# `mips*-mti-none-elf`
2 +
3 +**Tier: 3**
4 +
5 +MIPS32r2 baremetal softfloat, Big Endian or Little Endian.
6 +
7 +- mips-mti-none-elf
8 +- mipsel-mti-none-elf
9 +
10 +## Target maintainers
11 +
12 +- YunQiang Su, `syq@debian.org`, https://github.com/wzssyqa
13 +
14 +## Background
15 +
16 +These 2 targets, aka mips-mti-none-elf and mipsel-mti-none-elf, are for
17 +baremetal development of MIPS32r2. The lld is used instead of Gnu-ld.
18 +
19 +## Requirements
20 +
21 +The target only supports cross compilation and no host tools. The target
22 +supports `alloc` with a default allocator while only support `no-std` development.
23 +
24 +The vendor name `mti` follows the naming of gcc to indicate MIPS32r2.
25 +
26 +## Cross-compilation toolchains and C code
27 +
28 +Compatible C code can be built for this target on any compiler that has a MIPS32r2
29 +target. On clang and ld.lld linker, it can be generated using the
30 +`-march=mips`/`-march=mipsel`, `-mabi=32` with llvm features flag
31 +`features=+mips32r2,+soft-float,+noabicalls`.
Original file line number Diff line number Diff line change
@@ -128,6 +128,8 @@ static TARGETS: &[&str] = &[
128 128 "mipsisa64r6el-unknown-linux-gnuabi64",
129 129 "mipsel-unknown-linux-gnu",
130 130 "mipsel-unknown-linux-musl",
131 +"mips-mti-none-elf",
132 +"mipsel-mti-none-elf",
131 133 "nvptx64-nvidia-cuda",
132 134 "powerpc-unknown-linux-gnu",
133 135 "powerpc64-unknown-linux-gnu",
Original file line number Diff line number Diff line change
@@ -285,6 +285,12 @@
285 285 //@ revisions: mips_unknown_linux_uclibc
286 286 //@ [mips_unknown_linux_uclibc] compile-flags: --target mips-unknown-linux-uclibc
287 287 //@ [mips_unknown_linux_uclibc] needs-llvm-components: mips
288 +//@ revisions: mips_mti_none_elf
289 +//@ [mips_mti_none_elf] compile-flags: --target mips-mti-none-elf
290 +//@ [mips_mti_none_elf] needs-llvm-components: mips
291 +//@ revisions: mipsel_mti_none_elf
292 +//@ [mipsel_mti_none_elf] compile-flags: --target mipsel-mti-none-elf
293 +//@ [mipsel_mti_none_elf] needs-llvm-components: mips
288 294 //@ revisions: mipsel_sony_psp
289 295 //@ [mipsel_sony_psp] compile-flags: --target mipsel-sony-psp
290 296 //@ [mipsel_sony_psp] needs-llvm-components: mips
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ warning: unexpected `cfg` condition value: `value`
15 15 LL | #[cfg(target_vendor = "value")]
16 16 | ^^^^^^^^^^^^^^^^^^^^^^^
17 17 |
18 - = note: expected values for `target_vendor` are: `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `nintendo`, `nvidia`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs`
18 + = note: expected values for `target_vendor` are: `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `mti`, `nintendo`, `nvidia`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs`
19 19 = note: see https://doc.rust-lang.org/nightly/rustc/check-cfg.html for more information about checking conditional configuration
20 20
21 21 warning: unexpected `cfg` condition name: `feature`
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ warning: unexpected `cfg` condition value: `value`
15 15 LL | #[cfg(target_vendor = "value")]
16 16 | ^^^^^^^^^^^^^^^^^^^^^^^
17 17 |
18 - = note: expected values for `target_vendor` are: `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `nintendo`, `nvidia`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs`
18 + = note: expected values for `target_vendor` are: `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `mti`, `nintendo`, `nvidia`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs`
19 19 = note: see https://doc.rust-lang.org/nightly/rustc/check-cfg.html for more information about checking conditional configuration
20 20
21 21 warning: unexpected `cfg` condition value: `unk`