Skip to content

Commit 6642b4b

Browse files
committed
Add support for i586-unknown-netbsd as target.
This restricts instructions to those offered by Pentium, to support e.g. AMD Geode. There is already an entry for this target in the NetBSD platform support page at src/doc/rustc/src/platform-support/netbsd.md ...so this should forestall its removal. Additional fixes are needed for some vendored modules, this is the changes in the rust compiler core itself.
1 parent eb03d40 commit 6642b4b

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

compiler/rustc_llvm/build.rs

+6
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,12 @@ fn main() {
258258
{
259259
println!("cargo:rustc-link-lib=z");
260260
} else if target.contains("netbsd") {
261+
// Building for i586 or i686, we need -latomic for 64-bit atomics
262+
if target.starts_with("i586")
263+
|| target.starts_with("i686")
264+
{
265+
println!("cargo:rustc-link-lib=atomic");
266+
}
261267
println!("cargo:rustc-link-lib=z");
262268
println!("cargo:rustc-link-lib=execinfo");
263269
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use crate::spec::{Cc, Lld, LinkerFlavor, StackProbeType, Target, TargetOptions};
2+
3+
pub fn target() -> Target {
4+
let mut base = super::netbsd_base::opts();
5+
base.cpu = "pentium".into();
6+
base.max_atomic_width = Some(64);
7+
base.pre_link_args
8+
.entry(LinkerFlavor::Gnu(Cc::Yes, Lld::No))
9+
.or_default()
10+
.push("-m32".into());
11+
base.stack_probes = StackProbeType::Call;
12+
13+
Target {
14+
llvm_target: "i586-unknown-netbsdelf".into(),
15+
pointer_width: 32,
16+
data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
17+
f64:32:64-f80:32-n8:16:32-S128"
18+
.into(),
19+
arch: "x86".into(),
20+
options: TargetOptions { mcount: "__mcount".into(), ..base },
21+
}
22+
}

compiler/rustc_target/src/spec/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1426,6 +1426,7 @@ supported_targets! {
14261426
("aarch64_be-unknown-netbsd", aarch64_be_unknown_netbsd),
14271427
("armv6-unknown-netbsd-eabihf", armv6_unknown_netbsd_eabihf),
14281428
("armv7-unknown-netbsd-eabihf", armv7_unknown_netbsd_eabihf),
1429+
("i586-unknown-netbsd", i586_unknown_netbsd),
14291430
("i686-unknown-netbsd", i686_unknown_netbsd),
14301431
("powerpc-unknown-netbsd", powerpc_unknown_netbsd),
14311432
("riscv64gc-unknown-netbsd", riscv64gc_unknown_netbsd),

0 commit comments

Comments
 (0)