-
Notifications
You must be signed in to change notification settings - Fork 814
Description
The Android AArch64 build fails when assembling KleidiAI AArch64 .S files with SCons.
The SCons toolchain sets AS = <toolchain_prefix>as, which becomes llvm-as for NDK toolchains (because toolchain_prefix is set to .../bin/llvm-).
llvm-as is the LLVM IR assembler, not an AArch64 assembler, and it does not accept AArch64 mnemonics.
Even after setting AS = CC for Android, the assembler target flags are not propagated, so clang still defaults to the host target and fails to parse AArch64 instructions.
The issue was reproduced in OpenVINO CI: https://github.com/openvinotoolkit/openvino/actions/runs/21475861394/job/61860105092?pr=33871#step:14:7011
CI environment:
- Android NDK r29 (clang toolchain)
- AArch64 (arm64-v8.2-a), estate=64
Example failure (AArch64 Android, estate=64):
kai_matmul_clamp_f32_f32_f32p8x1biasf32_6x8x4_neon_mla_asm.S:52:22: error: expected ']' in brackets expression
stp x20, x21, [sp, -144]!
^
I fixed it by using CC as assembler and forwarding the target flags in SConstruct:
if env['os'] == 'windows':
...
elif env['os'] == 'android':
env['AS'] = env['CC']
env.Append(ASFLAGS = env['extra_cc_flags'])
This ensures clang assembles .S with the correct --target and prevents the AArch64 syntax errors.