Commit 548858d9 authored by Richard Townsend's avatar Richard Townsend Committed by Commit Bot

build: add support for armasm64.exe

armasm64.exe is Microsoft's reference compiler for 64-bit Arm assembly code.
This is needed to make sure that V8 can be tested and cross-compiled
under MSVC for Windows on Arm systems.

Bug: v8:10012
Change-Id: Id1b9ab7bb0cc96179a707e9746f9e78e8da30de9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2071941
Commit-Queue: Richard Townsend <richard.townsend@arm.com>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Auto-Submit: Richard Townsend <richard.townsend@arm.com>
Reviewed-by: default avatarBruce Dawson <brucedawson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747010}
parent 52f55d23
...@@ -221,21 +221,40 @@ template("msvc_toolchain") { ...@@ -221,21 +221,40 @@ template("msvc_toolchain") {
} }
tool("asm") { tool("asm") {
is_msvc_assembler = true
if (toolchain_args.current_cpu == "arm64") { if (toolchain_args.current_cpu == "arm64") {
prefix = rebase_path("$clang_base_path/bin", root_build_dir) if (is_clang) {
ml = "${clang_prefix}${prefix}/${clang_cl} --target=arm64-windows" prefix = rebase_path("$clang_base_path/bin", root_build_dir)
if (host_os == "win") { ml = "${clang_prefix}${prefix}/${clang_cl} --target=arm64-windows"
# Flip the slashes so that copy/paste of the command works. if (host_os == "win") {
ml = string_replace(ml, "/", "\\") # Flip the slashes so that copy/paste of the command works.
ml = string_replace(ml, "/", "\\")
}
ml += " -c -o{{output}}"
is_msvc_assembler = false
} else {
# Only affects Arm builds with is_clang = false, implemented for building
# V8 for Windows on Arm systems with the MSVC toolchain.
ml = "armasm64.exe"
} }
ml += " -c -o{{output}}"
} else { } else {
# x86/x64 builds always use the MSVC assembler.
if (toolchain_args.current_cpu == "x64") { if (toolchain_args.current_cpu == "x64") {
ml = "ml64.exe" ml = "ml64.exe"
} else { } else {
ml = "ml.exe" ml = "ml.exe"
} }
ml += " /nologo /c /Fo{{output}}" }
if (is_msvc_assembler) {
ml += " /nologo /Fo{{output}}"
# Suppress final-stage linking on x64/x86 builds. (Armasm64 does not
# require /c because it doesn't support linking.)
if (toolchain_args.current_cpu != "arm64") {
ml += " /c"
}
if (use_lld) { if (use_lld) {
# Wrap ml(64).exe with a script that makes its output deterministic. # Wrap ml(64).exe with a script that makes its output deterministic.
# It's lld only because the script zaps obj Timestamp which # It's lld only because the script zaps obj Timestamp which
...@@ -247,7 +266,15 @@ template("msvc_toolchain") { ...@@ -247,7 +266,15 @@ template("msvc_toolchain") {
ml = "$python_path $ml_py $ml" ml = "$python_path $ml_py $ml"
} }
} }
command = "$python_path $tool_wrapper_path asm-wrapper $env $ml {{defines}} {{include_dirs}} {{asmflags}} {{source}}" if (toolchain_args.current_cpu != "arm64" || is_clang) {
command = "$python_path $tool_wrapper_path asm-wrapper $env $ml {{defines}} {{include_dirs}} {{asmflags}} {{source}}"
} else {
# armasm64.exe does not support definitions passed via the command line.
# (Fortunately, they're not needed for compiling the V8 snapshot, which
# is the only time this assembler is required.)
command = "$python_path $tool_wrapper_path asm-wrapper $env $ml {{include_dirs}} {{asmflags}} {{source}}"
}
description = "ASM {{output}}" description = "ASM {{output}}"
outputs = [ "$object_subdir/{{source_name_part}}.obj" ] outputs = [ "$object_subdir/{{source_name_part}}.obj" ]
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment