Skip to content

Commit d38becc

Browse files
authored
Rollup merge of rust-lang#38413 - rillian:armv7-neon, r=alexcrichton
rustc: Disable NEON on armv7 android. We thought Google's ABI for arvm7 required neon, but it is currently optional, perhaps because there is a significant population of Tegra 2 devices still in use. This turns off neon code generation outside #[target-feature] blocks just like we do on armv7-unknown-linux-gnu, but unlike most other armv7 targets. LLVM defaults to +neon for this target, so an explicit disable is necessary. See https://developer.android.com/ndk/guides/abis.html#v7a for instruction set extension requirements. Closes rust-lang#38402.
2 parents 0c4e1db + 9e01f76 commit d38becc

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/librustc_back/target/aarch64_linux_android.rs

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

1111
use target::{Target, TargetOptions, TargetResult};
1212

13+
// See https://developer.android.com/ndk/guides/abis.html#arm64-v8a
14+
// for target ABI requirements.
15+
1316
pub fn target() -> TargetResult {
1417
let mut base = super::android_base::opts();
1518
base.max_atomic_width = Some(128);

src/librustc_back/target/armv7_linux_androideabi.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -10,9 +10,12 @@
1010

1111
use target::{Target, TargetOptions, TargetResult};
1212

13+
// See https://developer.android.com/ndk/guides/abis.html#v7a
14+
// for target ABI requirements.
15+
1316
pub fn target() -> TargetResult {
1417
let mut base = super::android_base::opts();
15-
base.features = "+v7,+thumb2,+vfp3,+d16".to_string();
18+
base.features = "+v7,+thumb2,+vfp3,+d16,-neon".to_string();
1619
base.max_atomic_width = Some(64);
1720

1821
Ok(Target {

src/librustc_back/target/i686_linux_android.rs

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

1111
use target::{Target, TargetResult};
1212

13+
// See https://developer.android.com/ndk/guides/abis.html#x86
14+
// for target ABI requirements.
15+
1316
pub fn target() -> TargetResult {
1417
let mut base = super::android_base::opts();
1518

0 commit comments

Comments
 (0)