Skip to content

Commit 072fdae

Browse files
committed
Add targets thumbv7neon-linux-androideabi and thumbv7neon-unknown-linux-gnueabihf
These two targets enable both thumb-mode and NEON for ARMv7 CPUs.
1 parent 7ee7207 commit 072fdae

File tree

14 files changed

+134
-20
lines changed

14 files changed

+134
-20
lines changed

src/Cargo.lock

+18-18
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ name = "alloc_jemalloc"
2020
version = "0.0.0"
2121
dependencies = [
2222
"build_helper 0.1.0",
23-
"cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
23+
"cc 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
2424
"compiler_builtins 0.0.0",
2525
"core 0.0.0",
2626
"libc 0.0.0",
@@ -112,7 +112,7 @@ name = "backtrace-sys"
112112
version = "0.1.24"
113113
source = "registry+https://github.com/rust-lang/crates.io-index"
114114
dependencies = [
115-
"cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
115+
"cc 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
116116
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
117117
]
118118

@@ -131,7 +131,7 @@ name = "bootstrap"
131131
version = "0.0.0"
132132
dependencies = [
133133
"build_helper 0.1.0",
134-
"cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
134+
"cc 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
135135
"cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)",
136136
"filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
137137
"getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -240,7 +240,7 @@ version = "0.1.0"
240240

241241
[[package]]
242242
name = "cc"
243-
version = "1.0.22"
243+
version = "1.0.24"
244244
source = "registry+https://github.com/rust-lang/crates.io-index"
245245

246246
[[package]]
@@ -356,7 +356,7 @@ name = "cmake"
356356
version = "0.1.33"
357357
source = "registry+https://github.com/rust-lang/crates.io-index"
358358
dependencies = [
359-
"cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
359+
"cc 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
360360
]
361361

362362
[[package]]
@@ -387,7 +387,7 @@ dependencies = [
387387
name = "compiler_builtins"
388388
version = "0.0.0"
389389
dependencies = [
390-
"cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
390+
"cc 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
391391
"core 0.0.0",
392392
]
393393

@@ -564,7 +564,7 @@ name = "curl-sys"
564564
version = "0.4.8"
565565
source = "registry+https://github.com/rust-lang/crates.io-index"
566566
dependencies = [
567-
"cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
567+
"cc 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
568568
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
569569
"libz-sys 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)",
570570
"openssl-sys 0.9.35 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1066,7 +1066,7 @@ name = "libgit2-sys"
10661066
version = "0.7.7"
10671067
source = "registry+https://github.com/rust-lang/crates.io-index"
10681068
dependencies = [
1069-
"cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
1069+
"cc 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
10701070
"cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)",
10711071
"curl-sys 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
10721072
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1094,7 +1094,7 @@ name = "libz-sys"
10941094
version = "1.0.20"
10951095
source = "registry+https://github.com/rust-lang/crates.io-index"
10961096
dependencies = [
1097-
"cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
1097+
"cc 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
10981098
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
10991099
"pkg-config 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
11001100
"vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1142,7 +1142,7 @@ name = "lzma-sys"
11421142
version = "0.1.10"
11431143
source = "registry+https://github.com/rust-lang/crates.io-index"
11441144
dependencies = [
1145-
"cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
1145+
"cc 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
11461146
"filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
11471147
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
11481148
"pkg-config 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1246,7 +1246,7 @@ name = "miniz-sys"
12461246
version = "0.1.10"
12471247
source = "registry+https://github.com/rust-lang/crates.io-index"
12481248
dependencies = [
1249-
"cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
1249+
"cc 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
12501250
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
12511251
]
12521252

@@ -1356,15 +1356,15 @@ name = "openssl-src"
13561356
version = "110.0.7+1.1.0i"
13571357
source = "registry+https://github.com/rust-lang/crates.io-index"
13581358
dependencies = [
1359-
"cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
1359+
"cc 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
13601360
]
13611361

13621362
[[package]]
13631363
name = "openssl-sys"
13641364
version = "0.9.35"
13651365
source = "registry+https://github.com/rust-lang/crates.io-index"
13661366
dependencies = [
1367-
"cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
1367+
"cc 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
13681368
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
13691369
"openssl-src 110.0.7+1.1.0i (registry+https://github.com/rust-lang/crates.io-index)",
13701370
"pkg-config 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1571,7 +1571,7 @@ dependencies = [
15711571
name = "profiler_builtins"
15721572
version = "0.0.0"
15731573
dependencies = [
1574-
"cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
1574+
"cc 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
15751575
"compiler_builtins 0.0.0",
15761576
"core 0.0.0",
15771577
]
@@ -2084,7 +2084,7 @@ dependencies = [
20842084
name = "rustc_codegen_llvm"
20852085
version = "0.0.0"
20862086
dependencies = [
2087-
"cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
2087+
"cc 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
20882088
"memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
20892089
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
20902090
"rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2217,7 +2217,7 @@ name = "rustc_llvm"
22172217
version = "0.0.0"
22182218
dependencies = [
22192219
"build_helper 0.1.0",
2220-
"cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
2220+
"cc 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
22212221
]
22222222

22232223
[[package]]
@@ -2620,7 +2620,7 @@ dependencies = [
26202620
"alloc_jemalloc 0.0.0",
26212621
"alloc_system 0.0.0",
26222622
"build_helper 0.1.0",
2623-
"cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
2623+
"cc 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
26242624
"compiler_builtins 0.0.0",
26252625
"core 0.0.0",
26262626
"libc 0.0.0",
@@ -3123,7 +3123,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
31233123
"checksum bufstream 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f382711e76b9de6c744cc00d0497baba02fb00a787f088c879f01d09468e32"
31243124
"checksum byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "74c0b906e9446b0a2e4f760cdb3fa4b2c48cdc6db8766a845c54b6ff063fd2e9"
31253125
"checksum cargo_metadata 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d6809b327f87369e6f3651efd2c5a96c49847a3ed2559477ecba79014751ee1"
3126-
"checksum cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)" = "4a6007c146fdd28d4512a794b07ffe9d8e89e6bf86e2e0c4ddff2e1fb54a0007"
3126+
"checksum cc 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "70f2a88c2e69ceee91c209d8ef25b81fc1a65f42c7f14dfd59d1fed189e514d1"
31273127
"checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3"
31283128
"checksum chalk-engine 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "25ce2f28f55ed544a2a3756b7acf41dd7d6f27acffb2086439950925506af7d0"
31293129
"checksum chalk-macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "295635afd6853aa9f20baeb7f0204862440c0fe994c5a253d5f479dac41d047e"

src/bootstrap/cc_detect.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,10 @@ fn set_compiler(cfg: &mut cc::Build,
143143
// compiler already takes into account the triple in question.
144144
t if t.contains("android") => {
145145
if let Some(ndk) = config.and_then(|c| c.ndk.as_ref()) {
146-
let target = target.replace("armv7", "arm");
146+
let target = target.replace("armv7neon", "arm")
147+
.replace("armv7", "arm")
148+
.replace("thumbv7neon", "arm")
149+
.replace("thumbv7", "arm");
147150
let compiler = format!("{}-{}", target, compiler.clang());
148151
cfg.compiler(ndk.join("bin").join(compiler));
149152
}

src/bootstrap/configure.py

+2
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ def v(*args):
105105
"arm-linux-androideabi NDK standalone path")
106106
v("armv7-linux-androideabi-ndk", "target.armv7-linux-androideabi.android-ndk",
107107
"armv7-linux-androideabi NDK standalone path")
108+
v("thumbv7neon-linux-androideabi-ndk", "target.thumbv7neon-linux-androideabi.android-ndk",
109+
"thumbv7neon-linux-androideabi NDK standalone path")
108110
v("aarch64-linux-android-ndk", "target.aarch64-linux-android.android-ndk",
109111
"aarch64-linux-android NDK standalone path")
110112
v("x86_64-linux-android-ndk", "target.x86_64-linux-android.android-ndk",

src/bootstrap/native.rs

+2
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,9 @@ impl Step for Openssl {
644644
"arm-unknown-linux-gnueabihf" => "linux-armv4",
645645
"armv6-unknown-netbsd-eabihf" => "BSD-generic32",
646646
"armv7-linux-androideabi" => "android-armv7",
647+
"thumbv7neon-linux-androideabi" => "android-armv7",
647648
"armv7-unknown-linux-gnueabihf" => "linux-armv4",
649+
"thumbv7neon-unknown-linux-gnueabihf" => "linux-armv4",
648650
"armv7-unknown-netbsd-eabihf" => "BSD-generic32",
649651
"i586-unknown-linux-gnu" => "linux-elf",
650652
"i586-unknown-linux-musl" => "linux-elf",

src/ci/docker/dist-android/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ RUN . /scripts/android-ndk.sh && \
1616
# env
1717
ENV TARGETS=arm-linux-androideabi
1818
ENV TARGETS=$TARGETS,armv7-linux-androideabi
19+
ENV TARGETS=$TARGETS,thumbv7neon-linux-androideabi
1920
ENV TARGETS=$TARGETS,i686-linux-android
2021
ENV TARGETS=$TARGETS,aarch64-linux-android
2122
ENV TARGETS=$TARGETS,x86_64-linux-android
@@ -24,6 +25,7 @@ ENV RUST_CONFIGURE_ARGS \
2425
--enable-extended \
2526
--arm-linux-androideabi-ndk=/android/ndk/arm-14 \
2627
--armv7-linux-androideabi-ndk=/android/ndk/arm-14 \
28+
--thumbv7neon-linux-androideabi-ndk=/android/ndk/arm-14 \
2729
--i686-linux-android-ndk=/android/ndk/x86-14 \
2830
--aarch64-linux-android-ndk=/android/ndk/arm64-21 \
2931
--x86_64-linux-android-ndk=/android/ndk/x86_64-21 \

src/librustc_target/spec/armv7_linux_androideabi.rs

+5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010

1111
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
1212

13+
// This target if is for the baseline of the Android v7a ABI
14+
// in thumb mode. It's named armv7-* instead of thumbv7-*
15+
// for historical reasons. See the thumbv7neon variant for
16+
// enabling NEON.
17+
1318
// See https://developer.android.com/ndk/guides/abis.html#v7a
1419
// for target ABI requirements.
1520

src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
1212

13+
// This target is for glibc Linux on ARMv7 without NEON or
14+
// thumb-mode. See the thumbv7neon variant for enabling both.
15+
1316
pub fn target() -> TargetResult {
1417
let base = super::linux_base::opts();
1518
Ok(Target {

src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
use spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
1212

13+
// This target is for musl Linux on ARMv7 without thumb-mode or NEON.
14+
1315
pub fn target() -> TargetResult {
1416
let base = super::linux_musl_base::opts();
1517
Ok(Target {

src/librustc_target/spec/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ supported_targets! {
311311
("armv5te-unknown-linux-gnueabi", armv5te_unknown_linux_gnueabi),
312312
("armv5te-unknown-linux-musleabi", armv5te_unknown_linux_musleabi),
313313
("armv7-unknown-linux-gnueabihf", armv7_unknown_linux_gnueabihf),
314+
("thumbv7neon-unknown-linux-gnueabihf", thumbv7neon_unknown_linux_gnueabihf),
314315
("armv7-unknown-linux-musleabihf", armv7_unknown_linux_musleabihf),
315316
("aarch64-unknown-linux-gnu", aarch64_unknown_linux_gnu),
316317

@@ -328,6 +329,7 @@ supported_targets! {
328329
("x86_64-linux-android", x86_64_linux_android),
329330
("arm-linux-androideabi", arm_linux_androideabi),
330331
("armv7-linux-androideabi", armv7_linux_androideabi),
332+
("thumbv7neon-linux-androideabi", thumbv7neon_linux_androideabi),
331333
("aarch64-linux-android", aarch64_linux_android),
332334

333335
("aarch64-unknown-freebsd", aarch64_unknown_freebsd),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
// This target if is for the Android v7a ABI in thumb mode with
14+
// NEON unconditionally enabled and, therefore, with 32 FPU registers
15+
// enabled as well. See section A2.6.2 on page A2-56 in
16+
// https://static.docs.arm.com/ddi0406/cd/DDI0406C_d_armv7ar_arm.pdf
17+
18+
// See https://developer.android.com/ndk/guides/abis.html#v7a
19+
// for target ABI requirements.
20+
21+
pub fn target() -> TargetResult {
22+
let mut base = super::android_base::opts();
23+
base.features = "+v7,+thumb-mode,+thumb2,+vfp3,+neon".to_string();
24+
base.max_atomic_width = Some(64);
25+
base.pre_link_args
26+
.get_mut(&LinkerFlavor::Gcc).unwrap().push("-march=armv7-a".to_string());
27+
28+
Ok(Target {
29+
llvm_target: "armv7-none-linux-android".to_string(),
30+
target_endian: "little".to_string(),
31+
target_pointer_width: "32".to_string(),
32+
target_c_int_width: "32".to_string(),
33+
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
34+
arch: "arm".to_string(),
35+
target_os: "android".to_string(),
36+
target_env: "".to_string(),
37+
target_vendor: "unknown".to_string(),
38+
linker_flavor: LinkerFlavor::Gcc,
39+
options: TargetOptions {
40+
abi_blacklist: super::arm_base::abi_blacklist(),
41+
.. base
42+
},
43+
})
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
// This target is for glibc Linux on ARMv7 with thumb mode enabled
14+
// (for consistency with Android and Debian-based distributions)
15+
// and with NEON unconditionally enabled and, therefore, with 32 FPU
16+
// registers enabled as well. See section A2.6.2 on page A2-56 in
17+
// https://static.docs.arm.com/ddi0406/cd/DDI0406C_d_armv7ar_arm.pdf
18+
19+
pub fn target() -> TargetResult {
20+
let base = super::linux_base::opts();
21+
Ok(Target {
22+
llvm_target: "armv7-unknown-linux-gnueabihf".to_string(),
23+
target_endian: "little".to_string(),
24+
target_pointer_width: "32".to_string(),
25+
target_c_int_width: "32".to_string(),
26+
data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
27+
arch: "arm".to_string(),
28+
target_os: "linux".to_string(),
29+
target_env: "gnu".to_string(),
30+
target_vendor: "unknown".to_string(),
31+
linker_flavor: LinkerFlavor::Gcc,
32+
33+
options: TargetOptions {
34+
// Info about features at https://wiki.debian.org/ArmHardFloatPort
35+
features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".to_string(),
36+
cpu: "generic".to_string(),
37+
max_atomic_width: Some(64),
38+
abi_blacklist: super::arm_base::abi_blacklist(),
39+
.. base
40+
}
41+
})
42+
}

src/test/run-make-fulldeps/atomic-lock-free/Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ ifeq ($(filter arm,$(LLVM_COMPONENTS)),arm)
1818
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
1919
$(RUSTC) --target=armv7-unknown-linux-gnueabihf atomic_lock_free.rs
2020
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
21+
$(RUSTC) --target=thumbv7neon-unknown-linux-gnueabihf atomic_lock_free.rs
22+
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
2123
endif
2224
ifeq ($(filter aarch64,$(LLVM_COMPONENTS)),aarch64)
2325
$(RUSTC) --target=aarch64-unknown-linux-gnu atomic_lock_free.rs

src/tools/build-manifest/src/main.rs

+2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ static TARGETS: &'static [&'static str] = &[
6060
"armv5te-unknown-linux-musleabi",
6161
"armv7-apple-ios",
6262
"armv7-linux-androideabi",
63+
"thumbv7neon-linux-androideabi",
6364
"armv7-unknown-cloudabi-eabihf",
6465
"armv7-unknown-linux-gnueabihf",
66+
"thumbv7neon-unknown-linux-gnueabihf",
6567
"armv7-unknown-linux-musleabihf",
6668
"armebv7r-none-eabi",
6769
"armebv7r-none-eabihf",

src/tools/compiletest/src/runtest.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,10 @@ pub fn make_diff(expected: &str, actual: &str, context_size: usize) -> Vec<Misma
167167

168168
pub fn run(config: Config, testpaths: &TestPaths, revision: Option<&str>) {
169169
match &*config.target {
170-
"arm-linux-androideabi" | "armv7-linux-androideabi" | "aarch64-linux-android" => {
170+
"arm-linux-androideabi"
171+
| "armv7-linux-androideabi"
172+
| "thumbv7neon-linux-androideabi"
173+
| "aarch64-linux-android" => {
171174
if !config.adb_device_status {
172175
panic!("android device not available");
173176
}

0 commit comments

Comments
 (0)