提交 7914e6fb 编写于 作者: K kennytm 提交者: GitHub

Rollup merge of #45094 - japaric:strict-align, r=alexcrichton

enable strict alignment (+strict-align) on ARMv6

As discovered in #44538 ARMv6 devices may or may not support unaligned memory accesses. ARMv6
Linux *seems* to have no problem with unaligned accesses but this is because the kernel is stepping
in to fix each unaligned memory access -- this incurs in a performance penalty.

This commit enforces aligned memory accesses on all our in-tree ARM targets that may be used with
ARMv6 devices. This should improve performance of Rust programs on ARMv6 devices. For the record,
clang also applies this attribute when targeting ARMv6 devices that are not running Darwin or
NetBSD.

closes #44538
r? @alexcrichton
......@@ -14,7 +14,7 @@
pub fn target() -> TargetResult {
let mut base = super::android_base::opts();
// https://developer.android.com/ndk/guides/abis.html#armeabi
base.features = "+v5te".to_string();
base.features = "+strict-align,+v5te".to_string();
base.max_atomic_width = Some(64);
Ok(Target {
......
......@@ -27,7 +27,7 @@ pub fn target() -> TargetResult {
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions {
features: "+v6".to_string(),
features: "+strict-align,+v6".to_string(),
abi_blacklist: super::arm_base::abi_blacklist(),
.. base
},
......
......@@ -27,7 +27,7 @@ pub fn target() -> TargetResult {
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions {
features: "+v6,+vfp2".to_string(),
features: "+strict-align,+v6,+vfp2".to_string(),
abi_blacklist: super::arm_base::abi_blacklist(),
.. base
}
......
......@@ -16,7 +16,7 @@ pub fn target() -> TargetResult {
// Most of these settings are copied from the arm_unknown_linux_gnueabi
// target.
base.features = "+v6".to_string();
base.features = "+strict-align,+v6".to_string();
base.max_atomic_width = Some(64);
Ok(Target {
// It's important we use "gnueabi" and not "musleabi" here. LLVM uses it
......
......@@ -16,7 +16,7 @@ pub fn target() -> TargetResult {
// Most of these settings are copied from the arm_unknown_linux_gnueabihf
// target.
base.features = "+v6,+vfp2".to_string();
base.features = "+strict-align,+v6,+vfp2".to_string();
base.max_atomic_width = Some(64);
Ok(Target {
// It's important we use "gnueabihf" and not "musleabihf" here. LLVM
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册