forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#135074 - wzssyqa:mips-mti, r=oli-obk
Target: Add mips mti baremetal support Do the same thing as gcc, which use the vendor `mti` to mark the toolchain as MIPS32r2 default. We support both big endian and little endian flavor: mips-mti-none-elf mipsel-mti-none-elf
- Loading branch information
Showing
12 changed files
with
120 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
compiler/rustc_target/src/spec/targets/mips_mti_none_elf.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use crate::abi::Endian; | ||
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; | ||
|
||
pub(crate) fn target() -> Target { | ||
Target { | ||
data_layout: "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".into(), | ||
llvm_target: "mips".into(), | ||
metadata: crate::spec::TargetMetadata { | ||
description: Some("MIPS32r2 BE Baremetal Softfloat".into()), | ||
tier: Some(3), | ||
host_tools: Some(false), | ||
std: None, // ? | ||
}, | ||
pointer_width: 32, | ||
arch: "mips".into(), | ||
|
||
options: TargetOptions { | ||
vendor: "mti".into(), | ||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), | ||
linker: Some("rust-lld".into()), | ||
endian: Endian::Big, | ||
cpu: "mips32r2".into(), | ||
|
||
max_atomic_width: Some(32), | ||
|
||
features: "+mips32r2,+soft-float,+noabicalls".into(), | ||
executables: true, | ||
panic_strategy: PanicStrategy::Abort, | ||
relocation_model: RelocModel::Static, | ||
emit_debug_gdb_scripts: false, | ||
eh_frame_header: false, | ||
singlethread: true, | ||
..Default::default() | ||
}, | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
compiler/rustc_target/src/spec/targets/mipsel_mti_none_elf.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use crate::abi::Endian; | ||
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; | ||
|
||
pub(crate) fn target() -> Target { | ||
Target { | ||
data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".into(), | ||
llvm_target: "mipsel".into(), | ||
metadata: crate::spec::TargetMetadata { | ||
description: Some("MIPS32r2 LE Baremetal Softfloat".into()), | ||
tier: Some(3), | ||
host_tools: Some(false), | ||
std: None, // ? | ||
}, | ||
pointer_width: 32, | ||
arch: "mips".into(), | ||
|
||
options: TargetOptions { | ||
vendor: "mti".into(), | ||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), | ||
linker: Some("rust-lld".into()), | ||
endian: Endian::Little, | ||
cpu: "mips32r2".into(), | ||
|
||
max_atomic_width: Some(32), | ||
|
||
features: "+mips32r2,+soft-float,+noabicalls".into(), | ||
executables: true, | ||
panic_strategy: PanicStrategy::Abort, | ||
relocation_model: RelocModel::Static, | ||
emit_debug_gdb_scripts: false, | ||
eh_frame_header: false, | ||
singlethread: true, | ||
..Default::default() | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# `mips*-mti-none-elf` | ||
|
||
**Tier: 3** | ||
|
||
MIPS32r2 baremetal softfloat, Big Endian or Little Endian. | ||
|
||
- mips-mti-none-elf | ||
- mipsel-mti-none-elf | ||
|
||
## Target maintainers | ||
|
||
- YunQiang Su, `syq@debian.org`, https://github.com/wzssyqa | ||
|
||
## Background | ||
|
||
These 2 targets, aka mips-mti-none-elf and mipsel-mti-none-elf, are for | ||
baremetal development of MIPS32r2. The lld is used instead of Gnu-ld. | ||
|
||
## Requirements | ||
|
||
The target only supports cross compilation and no host tools. The target | ||
supports `alloc` with a default allocator while only support `no-std` development. | ||
|
||
The vendor name `mti` follows the naming of gcc to indicate MIPS32r2. | ||
|
||
## Cross-compilation toolchains and C code | ||
|
||
Compatible C code can be built for this target on any compiler that has a MIPS32r2 | ||
target. On clang and ld.lld linker, it can be generated using the | ||
`-march=mips`/`-march=mipsel`, `-mabi=32` with llvm features flag | ||
`features=+mips32r2,+soft-float,+noabicalls`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters