Skip to content

Commit 1336b56

Browse files
authored
Rollup merge of rust-lang#140758 - dpaoliello:armhazard, r=jieyouxu
[win][arm64] Disable MSVC Linker 'Arm Hazard' warning While trying to get the aarch64-msvc build working correctly (rust-lang#140136), I observed the following test failure: From <rust-lang#140136 (comment)> ``` = note: main.main.d17f5fbe6225cf88-cgu.0.rcgu.o : fatal error LNK1322: cannot avoid potential ARM hazard (Cortex-A53 MPCore processor bug #843419) in section 0x57; please consider using compiler option /Gy if it was not used ``` This is warning of a code sequence that triggers a bug in Cortex-A53 processors: <https://developer.arm.com/documentation/epm048406/latest> However, since Windows 10 isn't supported on the Cortex-A53, this warning is not required, so it can be suppressed using the undocumented `/arm64hazardfree` flag.
2 parents faa36f6 + 75ca6c6 commit 1336b56

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
use crate::spec::{Target, TargetMetadata, base};
1+
use crate::spec::{LinkerFlavor, Lld, Target, TargetMetadata, base};
22

33
pub(crate) fn target() -> Target {
44
let mut base = base::windows_msvc::opts();
55
base.max_atomic_width = Some(128);
66
base.features = "+v8a,+neon,+fp-armv8".into();
77

8+
// MSVC emits a warning about code that may trip "Cortex-A53 MPCore processor bug #843419" (see
9+
// https://developer.arm.com/documentation/epm048406/latest) which is sometimes emitted by LLVM.
10+
// Since Arm64 Windows 10+ isn't supported on that processor, it's safe to disable the warning.
11+
base.add_pre_link_args(LinkerFlavor::Msvc(Lld::No), &["/arm64hazardfree"]);
12+
813
Target {
914
llvm_target: "aarch64-pc-windows-msvc".into(),
1015
metadata: TargetMetadata {

0 commit comments

Comments
 (0)