From e900f6c7fe8c077f3a94500c70eee9cfaaa8eff5 Mon Sep 17 00:00:00 2001 From: Ralph Giles Date: Fri, 16 Dec 2016 10:54:48 -0800 Subject: [PATCH 1/2] 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 #38402. --- src/librustc_back/target/armv7_linux_androideabi.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc_back/target/armv7_linux_androideabi.rs b/src/librustc_back/target/armv7_linux_androideabi.rs index 42f0deaa3fbff..598b961a3048a 100644 --- a/src/librustc_back/target/armv7_linux_androideabi.rs +++ b/src/librustc_back/target/armv7_linux_androideabi.rs @@ -1,4 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -12,7 +12,7 @@ use target::{Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { let mut base = super::android_base::opts(); - base.features = "+v7,+thumb2,+vfp3,+d16".to_string(); + base.features = "+v7,+thumb2,+vfp3,+d16,-neon".to_string(); base.max_atomic_width = Some(64); Ok(Target { From 9e01f76349ec358009099dd5dc87b921960defc2 Mon Sep 17 00:00:00 2001 From: Ralph Giles Date: Fri, 16 Dec 2016 11:27:12 -0800 Subject: [PATCH 2/2] rustc: Link to Android ABI requirements. Hopefully these references will be stable and provide guidance when requirements change in the future. --- src/librustc_back/target/aarch64_linux_android.rs | 3 +++ src/librustc_back/target/armv7_linux_androideabi.rs | 3 +++ src/librustc_back/target/i686_linux_android.rs | 3 +++ 3 files changed, 9 insertions(+) diff --git a/src/librustc_back/target/aarch64_linux_android.rs b/src/librustc_back/target/aarch64_linux_android.rs index 140195c780b9c..54eead94986cc 100644 --- a/src/librustc_back/target/aarch64_linux_android.rs +++ b/src/librustc_back/target/aarch64_linux_android.rs @@ -10,6 +10,9 @@ use target::{Target, TargetOptions, TargetResult}; +// See https://developer.android.com/ndk/guides/abis.html#arm64-v8a +// for target ABI requirements. + pub fn target() -> TargetResult { let mut base = super::android_base::opts(); base.max_atomic_width = Some(128); diff --git a/src/librustc_back/target/armv7_linux_androideabi.rs b/src/librustc_back/target/armv7_linux_androideabi.rs index 598b961a3048a..36f409b7948c2 100644 --- a/src/librustc_back/target/armv7_linux_androideabi.rs +++ b/src/librustc_back/target/armv7_linux_androideabi.rs @@ -10,6 +10,9 @@ use target::{Target, TargetOptions, TargetResult}; +// See https://developer.android.com/ndk/guides/abis.html#v7a +// for target ABI requirements. + pub fn target() -> TargetResult { let mut base = super::android_base::opts(); base.features = "+v7,+thumb2,+vfp3,+d16,-neon".to_string(); diff --git a/src/librustc_back/target/i686_linux_android.rs b/src/librustc_back/target/i686_linux_android.rs index a2c007d496960..f8a8f5a3500be 100644 --- a/src/librustc_back/target/i686_linux_android.rs +++ b/src/librustc_back/target/i686_linux_android.rs @@ -10,6 +10,9 @@ use target::{Target, TargetResult}; +// See https://developer.android.com/ndk/guides/abis.html#x86 +// for target ABI requirements. + pub fn target() -> TargetResult { let mut base = super::android_base::opts();