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).
This commit is contained in:
Stuart Cook 2025-08-10 19:45:50 +10:00 committed by GitHub
commit 2e0829173b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);