Auto merge of #135085 - knickish:m68k_unknown_none, r=workingjubilee

add m68k-unknown-none-elf target

r? `@workingjubilee`

The existing `m68k-unknown-linux-gnu` target builds `std` by default, requires atomics, and has a base cpu with an fpu. A smaller/more embedded target is desirable both to have a baseline target for the ISA, as well to make debugging easier for working on the llvm backend. Currently this target is using the `M68010` as the minimum CPU due, but as missing features are merged into the `M68k` llvm backend I am hoping to lower this further.

I have been able to build very small crates using a toolchain built against this target (together with a later version of `object`) using the configuration described in the target platform-support documentation, although getting anything of substantial complexity to build quickly hits errors in the llvm backend
This commit is contained in:
bors 2025-01-06 05:23:55 +00:00
commit fd98df8f14
7 changed files with 148 additions and 0 deletions

View file

@ -1656,6 +1656,7 @@ supported_targets! {
("loongarch64-unknown-linux-gnu", loongarch64_unknown_linux_gnu),
("loongarch64-unknown-linux-musl", loongarch64_unknown_linux_musl),
("m68k-unknown-linux-gnu", m68k_unknown_linux_gnu),
("m68k-unknown-none-elf", m68k_unknown_none_elf),
("csky-unknown-linux-gnuabiv2", csky_unknown_linux_gnuabiv2),
("csky-unknown-linux-gnuabiv2hf", csky_unknown_linux_gnuabiv2hf),
("mips-unknown-linux-gnu", mips_unknown_linux_gnu),

View file

@ -0,0 +1,33 @@
use crate::abi::Endian;
use crate::spec::{CodeModel, PanicStrategy, RelocModel, Target, TargetOptions};
pub(crate) fn target() -> Target {
let options = TargetOptions {
cpu: "M68010".into(),
max_atomic_width: None,
endian: Endian::Big,
// LLD currently does not have support for M68k
linker: Some("m68k-linux-gnu-ld".into()),
panic_strategy: PanicStrategy::Abort,
code_model: Some(CodeModel::Medium),
has_rpath: false,
// should be soft-float
llvm_floatabi: None,
relocation_model: RelocModel::Static,
..Default::default()
};
Target {
llvm_target: "m68k".into(),
metadata: crate::spec::TargetMetadata {
description: Some("Motorola 680x0".into()),
tier: Some(3),
host_tools: Some(false),
std: Some(false),
},
pointer_width: 32,
data_layout: "E-m:e-p:32:16:32-i8:8:8-i16:16:16-i32:16:32-n8:16:32-a:0:16-S16".into(),
arch: "m68k".into(),
options,
}
}