Skip to content

Commit

Permalink
Rollup merge of rust-lang#117356 - he32:netbsd-mipsel, r=oli-obk
Browse files Browse the repository at this point in the history
Add support for mipsel-unknown-netbsd, 32-bit LE mips.
  • Loading branch information
GuillaumeGomez authored Oct 30, 2023
2 parents ead3561 + 5e6c313 commit 7d129fd
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
21 changes: 21 additions & 0 deletions compiler/rustc_target/src/spec/mipsel_unknown_netbsd.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use crate::abi::Endian;
use crate::spec::{Target, TargetOptions};

pub fn target() -> Target {
let mut base = super::netbsd_base::opts();
base.max_atomic_width = Some(32);
base.cpu = "mips32".into();

Target {
llvm_target: "mipsel-unknown-netbsd".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 {
features: "+soft-float".into(),
mcount: "__mcount".into(),
endian: Endian::Little,
..base
},
}
}
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1566,6 +1566,7 @@ supported_targets! {
("armv7-unknown-netbsd-eabihf", armv7_unknown_netbsd_eabihf),
("i586-unknown-netbsd", i586_unknown_netbsd),
("i686-unknown-netbsd", i686_unknown_netbsd),
("mipsel-unknown-netbsd", mipsel_unknown_netbsd),
("powerpc-unknown-netbsd", powerpc_unknown_netbsd),
("riscv64gc-unknown-netbsd", riscv64gc_unknown_netbsd),
("sparc64-unknown-netbsd", sparc64_unknown_netbsd),
Expand Down
6 changes: 6 additions & 0 deletions src/bootstrap/src/core/build_steps/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,12 @@ impl Step for Llvm {
ldflags.shared.push(" -latomic");
}

if target.starts_with("mips") && target.contains("netbsd") {
// LLVM wants 64-bit atomics, while mipsel is 32-bit only, so needs -latomic
ldflags.exe.push(" -latomic");
ldflags.shared.push(" -latomic");
}

if target.contains("msvc") {
cfg.define("LLVM_USE_CRT_DEBUG", "MT");
cfg.define("LLVM_USE_CRT_RELEASE", "MT");
Expand Down
1 change: 1 addition & 0 deletions src/doc/rustc/src/platform-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ target | std | host | notes
`mips64el-unknown-linux-muslabi64` | ✓ | | MIPS64 (little endian) Linux, N64 ABI, musl libc
`mipsel-unknown-linux-gnu` | ✓ | ✓ | MIPS (little endian) Linux (kernel 4.4, glibc 2.23)
`mipsel-unknown-linux-musl` | ✓ | | MIPS (little endian) Linux with musl libc
[`mipsel-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | 32-bit MIPS (LE), requires mips32 cpu support
`mipsel-sony-psp` | * | | MIPS (LE) Sony PlayStation Portable (PSP)
[`mipsel-sony-psx`](platform-support/mipsel-sony-psx.md) | * | | MIPS (LE) Sony PlayStation 1 (PSX)
`mipsel-unknown-linux-uclibc` | ✓ | | MIPS (LE) Linux with uClibc
Expand Down

0 comments on commit 7d129fd

Please sign in to comment.