Skip to content

Commit 2f4c1bc

Browse files
loader: Resolve armasm64 by full path for arm64 builds
CMake's MARMASM compiler detection (CMakeDetermineASM_MARMASMCompiler.cmake) only matches "ARM64", so for an arm64ec target it selects the 32-bit armasm, which cannot assemble arm64ec code. It also leaves CMAKE_ASM_MARMASM_COMPILER as a bare "armasm64", which the assembler check runs directly and so fails when the dev tools are not on PATH (e.g. a stock CI configure). Either way the check fails and unknown function support gets silently disabled. Find armasm64 next to the C compiler and point the language at its full path so a plain `-A arm64`/`-A arm64ec` configure works without a manual -DCMAKE_ASM_MARMASM_COMPILER override or a developer command prompt. Drop this once CMake's detection matches ARM64EC (#1884).
1 parent 7205aa5 commit 2f4c1bc

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

loader/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,24 @@ if(WIN32 AND NOT USE_GAS)
139139
if(CMAKE_VERSION VERSION_LESS "3.26.0")
140140
set(ASM_FAILURE_MSG ${ARMASM_CMAKE_FAILURE_MSG})
141141
else()
142+
# CMake's MARMASM detection regex only matches "ARM64", so for arm64ec it
143+
# picks the 32-bit armasm, and even on arm64 it leaves the compiler as a bare
144+
# name that the check below can't run without the dev tools on PATH. Resolve
145+
# armasm64 (next to the C compiler) and use its full path. Drop this once
146+
# CMake's detection learns about ARM64EC.
147+
if(SYSTEM_PROCESSOR MATCHES "arm64")
148+
get_filename_component(MARMASM_TOOLCHAIN_DIR "${CMAKE_C_COMPILER}" DIRECTORY)
149+
find_program(MARMASM_ARMASM64 NAMES armasm64 HINTS "${MARMASM_TOOLCHAIN_DIR}")
150+
endif()
151+
if(MARMASM_ARMASM64)
152+
set(CMAKE_ASM_MARMASM_COMPILER "${MARMASM_ARMASM64}")
153+
endif()
142154
enable_language(ASM_MARMASM)
143155
set(LOADER_ASM_DIALECT "MARMASM")
156+
if(MARMASM_ARMASM64)
157+
# enable_language resets the compiler to a bare name; re-assert the full path.
158+
set(CMAKE_ASM_MARMASM_COMPILER "${MARMASM_ARMASM64}")
159+
endif()
144160
endif()
145161
else()
146162
enable_language(ASM_MASM)

0 commit comments

Comments
 (0)