Skip to content

Commit 0bb7335

Browse files
authored
Rollup merge of rust-lang#50864 - jakllsch:add-netbsd-arm-target-specs, r=alexcrichton
Add NetBSD/arm target specs
2 parents b4463d7 + ec779b9 commit 0bb7335

File tree

6 files changed

+76
-3
lines changed

6 files changed

+76
-3
lines changed

src/bootstrap/native.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,10 @@ impl Step for Openssl {
596596
"arm-linux-androideabi" => "android",
597597
"arm-unknown-linux-gnueabi" => "linux-armv4",
598598
"arm-unknown-linux-gnueabihf" => "linux-armv4",
599+
"armv6-unknown-netbsd-eabihf" => "BSD-generic32",
599600
"armv7-linux-androideabi" => "android-armv7",
600601
"armv7-unknown-linux-gnueabihf" => "linux-armv4",
602+
"armv7-unknown-netbsd-eabihf" => "BSD-generic32",
601603
"i586-unknown-linux-gnu" => "linux-elf",
602604
"i586-unknown-linux-musl" => "linux-elf",
603605
"i686-apple-darwin" => "darwin-i386-cc",

src/libpanic_unwind/gcc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const UNWIND_DATA_REG: (i32, i32) = (24, 25); // I0, I1
143143
// The personality routine for most of our targets, except ARM, which has a slightly different ABI
144144
// (however, iOS goes here as it uses SjLj unwinding). Also, the 64-bit Windows implementation
145145
// lives in seh64_gnu.rs
146-
#[cfg(all(any(target_os = "ios", not(target_arch = "arm"))))]
146+
#[cfg(all(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm"))))]
147147
#[lang = "eh_personality"]
148148
#[no_mangle]
149149
#[allow(unused)]
@@ -184,7 +184,7 @@ unsafe extern "C" fn rust_eh_personality(version: c_int,
184184

185185
// ARM EHABI personality routine.
186186
// http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038b/IHI0038B_ehabi.pdf
187-
#[cfg(all(target_arch = "arm", not(target_os = "ios")))]
187+
#[cfg(all(target_arch = "arm", not(target_os = "ios"), not(target_os = "netbsd")))]
188188
#[lang = "eh_personality"]
189189
#[no_mangle]
190190
unsafe extern "C" fn rust_eh_personality(state: uw::_Unwind_State,
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
12+
13+
pub fn target() -> TargetResult {
14+
let mut base = super::netbsd_base::opts();
15+
base.max_atomic_width = Some(64);
16+
Ok(Target {
17+
llvm_target: "armv6-unknown-netbsdelf-eabihf".to_string(),
18+
target_endian: "little".to_string(),
19+
target_pointer_width: "32".to_string(),
20+
target_c_int_width: "32".to_string(),
21+
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
22+
arch: "arm".to_string(),
23+
target_os: "netbsd".to_string(),
24+
target_env: "eabihf".to_string(),
25+
target_vendor: "unknown".to_string(),
26+
linker_flavor: LinkerFlavor::Gcc,
27+
28+
options: TargetOptions {
29+
features: "+v6,+vfp2".to_string(),
30+
abi_blacklist: super::arm_base::abi_blacklist(),
31+
.. base
32+
}
33+
})
34+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
12+
13+
pub fn target() -> TargetResult {
14+
let base = super::netbsd_base::opts();
15+
Ok(Target {
16+
llvm_target: "armv7-unknown-netbsdelf-eabihf".to_string(),
17+
target_endian: "little".to_string(),
18+
target_pointer_width: "32".to_string(),
19+
target_c_int_width: "32".to_string(),
20+
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
21+
arch: "arm".to_string(),
22+
target_os: "netbsd".to_string(),
23+
target_env: "eabihf".to_string(),
24+
target_vendor: "unknown".to_string(),
25+
linker_flavor: LinkerFlavor::Gcc,
26+
27+
options: TargetOptions {
28+
features: "+v7,+vfp3,+d16,+thumb2,-neon".to_string(),
29+
cpu: "generic".to_string(),
30+
max_atomic_width: Some(64),
31+
abi_blacklist: super::arm_base::abi_blacklist(),
32+
.. base
33+
}
34+
})
35+
}

src/librustc_target/spec/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ supported_targets! {
317317
("i686-unknown-openbsd", i686_unknown_openbsd),
318318
("x86_64-unknown-openbsd", x86_64_unknown_openbsd),
319319

320+
("armv6-unknown-netbsd-eabihf", armv6_unknown_netbsd_eabihf),
321+
("armv7-unknown-netbsd-eabihf", armv7_unknown_netbsd_eabihf),
320322
("i686-unknown-netbsd", i686_unknown_netbsd),
321323
("powerpc-unknown-netbsd", powerpc_unknown_netbsd),
322324
("sparc64-unknown-netbsd", sparc64_unknown_netbsd),

src/libunwind/libunwind.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ extern "C" {
9393
}
9494

9595
cfg_if! {
96-
if #[cfg(all(any(target_os = "ios", not(target_arch = "arm"))))] {
96+
if #[cfg(all(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm"))))] {
9797
// Not ARM EHABI
9898
#[repr(C)]
9999
#[derive(Copy, Clone, PartialEq)]

0 commit comments

Comments
 (0)