Skip to content

[win][arm64ec] Fix finding assembler and setting is_arm for Arm64EC #1511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,6 @@ impl Build {
}

let mut cmd = compiler.to_command();
let is_arm = matches!(target.arch, "aarch64" | "arm");
command_add_output_file(
&mut cmd,
&obj,
Expand All @@ -1410,7 +1409,7 @@ impl Build {
clang: compiler.is_like_clang(),
gnu: compiler.is_like_gnu(),
is_asm: false,
is_arm,
is_arm: is_arm(target),
},
);

Expand Down Expand Up @@ -1845,7 +1844,7 @@ impl Build {
}
cmd
};
let is_arm = matches!(target.arch, "aarch64" | "arm");
let is_arm = is_arm(&target);
command_add_output_file(
&mut cmd,
&obj.dst,
Expand Down Expand Up @@ -2594,14 +2593,11 @@ impl Build {

fn msvc_macro_assembler(&self) -> Result<Command, Error> {
let target = self.get_target()?;
let tool = if target.arch == "x86_64" {
"ml64.exe"
} else if target.arch == "arm" {
"armasm.exe"
} else if target.arch == "aarch64" {
"armasm64.exe"
} else {
"ml.exe"
let tool = match target.arch {
"x86_64" => "ml64.exe",
"arm" => "armasm.exe",
"aarch64" | "arm64ec" => "armasm64.exe",
_ => "ml.exe",
};
let mut cmd = self
.windows_registry_find(&target, tool)
Expand All @@ -2610,11 +2606,15 @@ impl Build {
for directory in self.include_directories.iter() {
cmd.arg("-I").arg(&**directory);
}
if target.arch == "aarch64" || target.arch == "arm" {
if is_arm(&target) {
if self.get_debug() {
cmd.arg("-g");
}

if target.arch == "arm64ec" {
cmd.args(["-machine", "ARM64EC"]);
}

for (key, value) in self.definitions.iter() {
cmd.arg("-PreDefine");
if let Some(ref value) = *value {
Expand Down Expand Up @@ -4304,6 +4304,10 @@ fn map_darwin_target_from_rust_to_compiler_architecture<'a>(target: &TargetInfo<
}
}

fn is_arm(target: &TargetInfo<'_>) -> bool {
matches!(target.arch, "aarch64" | "arm64ec" | "arm")
}

#[derive(Clone, Copy, PartialEq)]
enum AsmFileExt {
/// `.asm` files. On MSVC targets, we assume these should be passed to MASM
Expand Down
Loading