Skip to content

Commit b31f255

Browse files
authored
Rollup merge of rust-lang#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).
2 parents 305be1f + 87a09b2 commit b31f255

File tree

1 file changed

+7
-0
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+7
-0
lines changed

src/bootstrap/src/core/build_steps/llvm.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,13 @@ impl Step for Llvm {
421421
ldflags.shared.push(" -latomic");
422422
}
423423

424+
if target.starts_with("arm64ec") {
425+
// MSVC linker requires the -machine:arm64ec flag to be passed to
426+
// know it's linking as Arm64EC (vs Arm64X).
427+
ldflags.exe.push(" -machine:arm64ec");
428+
ldflags.shared.push(" -machine:arm64ec");
429+
}
430+
424431
if target.is_msvc() {
425432
cfg.define("CMAKE_MSVC_RUNTIME_LIBRARY", "MultiThreaded");
426433
cfg.static_crt(true);

0 commit comments

Comments
 (0)