Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for i586-unknown-netbsd as target. #117170

Merged
merged 7 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions compiler/rustc_llvm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,12 @@ fn main() {
{
println!("cargo:rustc-link-lib=z");
} else if target.contains("netbsd") {
// Building for i586 or i686, we need -latomic for 64-bit atomics
bjorn3 marked this conversation as resolved.
Show resolved Hide resolved
if target.starts_with("i586")
|| target.starts_with("i686")
{
println!("cargo:rustc-link-lib=atomic");
}
println!("cargo:rustc-link-lib=z");
println!("cargo:rustc-link-lib=execinfo");
}
Expand Down
22 changes: 22 additions & 0 deletions compiler/rustc_target/src/spec/i586_unknown_netbsd.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use crate::spec::{Cc, Lld, LinkerFlavor, StackProbeType, Target, TargetOptions};

pub fn target() -> Target {
let mut base = super::netbsd_base::opts();
base.cpu = "pentium".into();
base.max_atomic_width = Some(64);
base.pre_link_args
.entry(LinkerFlavor::Gnu(Cc::Yes, Lld::No))
.or_default()
.push("-m32".into());
base.stack_probes = StackProbeType::Call;

Target {
llvm_target: "i586-unknown-netbsdelf".into(),
pointer_width: 32,
data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
f64:32:64-f80:32-n8:16:32-S128"
.into(),
arch: "x86".into(),
options: TargetOptions { mcount: "__mcount".into(), ..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 @@ -1426,6 +1426,7 @@ supported_targets! {
("aarch64_be-unknown-netbsd", aarch64_be_unknown_netbsd),
("armv6-unknown-netbsd-eabihf", armv6_unknown_netbsd_eabihf),
("armv7-unknown-netbsd-eabihf", armv7_unknown_netbsd_eabihf),
("i586-unknown-netbsd", i586_unknown_netbsd),
("i686-unknown-netbsd", i686_unknown_netbsd),
("powerpc-unknown-netbsd", powerpc_unknown_netbsd),
("riscv64gc-unknown-netbsd", riscv64gc_unknown_netbsd),
Expand Down
Loading