about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-08-10 19:45:50 +1000
committerGitHub <noreply@github.com>2025-08-10 19:45:50 +1000
commit2e0829173be009c58b05cb8bbda4d223cae4cdc9 (patch)
tree33de490896334c34b1236750710186033a7a5a9e /src/bootstrap
parentbaa35853a9bfb7539427f8d891b1533ad88aba50 (diff)
parent87a09b2ad577fb6f9725dbc2e1adc5e75f783638 (diff)
downloadrust-2e0829173be009c58b05cb8bbda4d223cae4cdc9.tar.gz
rust-2e0829173be009c58b05cb8bbda4d223cae4cdc9.zip
Rollup merge of #145129 - dpaoliello:arm64eclink, r=wesleywiser
[win][arm64ec] Add `/machine:arm64ec` when linking LLVM as Arm64EC

When the MSVC linker sees an Arm64EC object file, it needs to know if it's linking the final executable as Arm64EC or Arm64X.

This change adds the `/machine:arm64ec` flag to the linker when building LLVM as Arm64EC to avoid that ambiguity (and resulting linker error).
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/src/core/build_steps/llvm.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs
index 065a39a4e71..79244827059 100644
--- a/src/bootstrap/src/core/build_steps/llvm.rs
+++ b/src/bootstrap/src/core/build_steps/llvm.rs
@@ -421,6 +421,13 @@ impl Step for Llvm {
             ldflags.shared.push(" -latomic");
         }
 
+        if target.starts_with("arm64ec") {
+            // MSVC linker requires the -machine:arm64ec flag to be passed to
+            // know it's linking as Arm64EC (vs Arm64X).
+            ldflags.exe.push(" -machine:arm64ec");
+            ldflags.shared.push(" -machine:arm64ec");
+        }
+
         if target.is_msvc() {
             cfg.define("CMAKE_MSVC_RUNTIME_LIBRARY", "MultiThreaded");
             cfg.static_crt(true);