1
Fork 0

Add Sony PlayStation 1 tier 3 target

This commit is contained in:
Ayrton 2022-10-04 21:37:30 -04:00
parent c27948d255
commit d03185ed98
5 changed files with 89 additions and 0 deletions

View file

@ -0,0 +1,37 @@
use crate::spec::{cvs, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
pub fn target() -> Target {
Target {
llvm_target: "mipsel-sony-psx".into(),
pointer_width: 32,
data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".into(),
arch: "mips".into(),
options: TargetOptions {
os: "none".into(),
env: "psx".into(),
vendor: "sony".into(),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
cpu: "mips1".into(),
executables: true,
linker: Some("rust-lld".into()),
relocation_model: RelocModel::Static,
exe_suffix: ".exe".into(),
// PSX doesn't natively support floats.
features: "+soft-float".into(),
// This should be 16 bits, but LLVM incorrectly tries emitting MIPS-II SYNC instructions
// for atomic loads and stores. This crashes rustc so we have to disable the Atomic* API
// until this is fixed upstream. See https://reviews.llvm.org/D122427#3420144 for more
// info.
max_atomic_width: Some(0),
// PSX does not support trap-on-condition instructions.
llvm_args: cvs!["-mno-check-zero-division"],
llvm_abiname: "o32".into(),
panic_strategy: PanicStrategy::Abort,
..Default::default()
},
}
}

View file

@ -1222,6 +1222,7 @@ supported_targets! {
("armv7a-kmc-solid_asp3-eabihf", armv7a_kmc_solid_asp3_eabihf),
("mipsel-sony-psp", mipsel_sony_psp),
("mipsel-sony-psx", mipsel_sony_psx),
("mipsel-unknown-none", mipsel_unknown_none),
("thumbv4t-none-eabi", thumbv4t_none_eabi),
("armv4t-none-eabi", armv4t_none_eabi),