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