rustc_target/spec/targets/mipsel_sony_psx.rs
1use crate::spec::{
2 Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions, cvs,
3};
4
5pub(crate) fn target() -> Target {
6 Target {
7 llvm_target: "mipsel-sony-psx".into(),
8 metadata: TargetMetadata {
9 description: Some("MIPS (LE) Sony PlayStation 1 (PSX)".into()),
10 tier: Some(3),
11 host_tools: Some(false),
12 std: Some(false),
13 },
14 pointer_width: 32,
15 data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".into(),
16 arch: "mips".into(),
17
18 options: TargetOptions {
19 // The Playstation 1 is mostly bare-metal, but the BIOS does provide some a slight bit
20 // of functionality post load, so we still declare it as `cfg!(target_os = "psx")`.
21 //
22 // See <https://github.com/rust-lang/rust/pull/131168> for details.
23 os: "psx".into(),
24 vendor: "sony".into(),
25 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
26 cpu: "mips1".into(),
27 executables: true,
28 linker: Some("rust-lld".into()),
29 relocation_model: RelocModel::Static,
30 exe_suffix: ".exe".into(),
31
32 // PSX doesn't natively support floats.
33 features: "+soft-float".into(),
34
35 // This should be 16 bits, but LLVM incorrectly tries emitting MIPS-II SYNC instructions
36 // for atomic loads and stores. This crashes rustc so we have to disable the Atomic* API
37 // until this is fixed upstream. See https://reviews.llvm.org/D122427#3420144 for more
38 // info.
39 max_atomic_width: Some(0),
40
41 // PSX does not support trap-on-condition instructions.
42 llvm_args: cvs!["-mno-check-zero-division"],
43 llvm_abiname: "o32".into(),
44 panic_strategy: PanicStrategy::Abort,
45 ..Default::default()
46 },
47 }
48}