Skip to content

Commit d01ebbb

Browse files
committed
Add target thumbv7neon-unknown-linux-musleabihf
This is a copy of thumbv7neon-unknown-linux-gnueabihf with musl changes merged from armv7-unknown-linux-musleabihf.
1 parent d2185f6 commit d01ebbb

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

src/librustc_target/spec/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ supported_targets! {
362362
("armv7-unknown-linux-gnueabi", armv7_unknown_linux_gnueabi),
363363
("armv7-unknown-linux-gnueabihf", armv7_unknown_linux_gnueabihf),
364364
("thumbv7neon-unknown-linux-gnueabihf", thumbv7neon_unknown_linux_gnueabihf),
365+
("thumbv7neon-unknown-linux-musleabihf", thumbv7neon_unknown_linux_musleabihf),
365366
("armv7-unknown-linux-musleabi", armv7_unknown_linux_musleabi),
366367
("armv7-unknown-linux-musleabihf", armv7_unknown_linux_musleabihf),
367368
("aarch64-unknown-linux-gnu", aarch64_unknown_linux_gnu),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
2+
3+
// This target is for musl Linux on ARMv7 with thumb mode enabled
4+
// (for consistency with Android and Debian-based distributions)
5+
// and with NEON unconditionally enabled and, therefore, with 32 FPU
6+
// registers enabled as well. See section A2.6.2 on page A2-56 in
7+
// https://static.docs.arm.com/ddi0406/cd/DDI0406C_d_armv7ar_arm.pdf
8+
9+
pub fn target() -> TargetResult {
10+
let base = super::linux_musl_base::opts();
11+
Ok(Target {
12+
// It's important we use "gnueabihf" and not "musleabihf" here. LLVM
13+
// uses it to determine the calling convention and float ABI, and LLVM
14+
// doesn't support the "musleabihf" value.
15+
llvm_target: "armv7-unknown-linux-gnueabihf".to_string(),
16+
target_endian: "little".to_string(),
17+
target_pointer_width: "32".to_string(),
18+
target_c_int_width: "32".to_string(),
19+
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
20+
arch: "arm".to_string(),
21+
target_os: "linux".to_string(),
22+
target_env: "musl".to_string(),
23+
target_vendor: "unknown".to_string(),
24+
linker_flavor: LinkerFlavor::Gcc,
25+
26+
// Most of these settings are copied from the thumbv7neon_unknown_linux_gnueabihf
27+
// target.
28+
options: TargetOptions {
29+
features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".to_string(),
30+
cpu: "generic".to_string(),
31+
max_atomic_width: Some(64),
32+
abi_blacklist: super::arm_base::abi_blacklist(),
33+
target_mcount: "\u{1}mcount".to_string(),
34+
.. base
35+
}
36+
})
37+
}

0 commit comments

Comments
 (0)