汇编未知助记符 AArch64 ARMv8

Assembly unknown mnemonic AArch64 ARMv8

我正在尝试使用几个汇编文件编译一个项目(来自 GitHub:link),这些文件是为 ARMv8 AArch64 架构编写的。当我尝试编译这些文件时,几乎每一行都出现相同的错误,它以:

开头

authenc_ac_gcm_low.S: Assembler messages:

authenc_ac_gcm_low.S:80: Error: unknown mnemonic `ld1.16b' -- `ld1.16b {v0},[x1]'
authenc_ac_gcm_low.S:81: Error: unknown mnemonic `rbit.16b' -- `rbit.16b v0,v0'
authenc_ac_gcm_low.S:82: Error: unknown mnemonic `st1.16b' -- `st1.16b {v0},[x0]'
authenc_ac_gcm_low.S:90: Error: unknown mnemonic `ld1.16b' -- `ld1.16b {v24},[x0]'
authenc_ac_gcm_low.S:92: Error: unknown mnemonic `ld1.16b' -- `ld1.16b {v0,v1,v2,v3},[x1],#64'
authenc_ac_gcm_low.S:93: Error: unknown mnemonic `ld1.16b' -- `ld1.16b {v4,v5,v6,v7},[x1]'

一小部分代码:(第 78 行到第 87 行)

ac_gcm_convert_low:
_ac_gcm_convert_low:
    ld1.16b {v0}, [x1]
    rbit.16b v0, v0
    st1.16b {v0}, [x0]
    ret

ac_gcm_ghash_low:
_ac_gcm_ghash_low:
    cbz x3, exit //this might be the only line it doesn't error

我正在为 AArch64 使用 Linaro 交叉编译器,为了编译我使用了 -mcpu=cortex-a53+crypto 标志;不这样做会导致 "no such instruction" 错误。 我对 Assembly 的经验很少,显然我在这里犯了一些错误,但我找不到它。如何消除错误?

看起来这是不稳定的 Apple 语法 - GCC 使用稍微更详细的 architectural syntax,其中大小说明符出现在每个寄存器参数上,而不是指令本身,例如

ld1 {v0.16b}, [x1]
rbit v0.16b, v0.16b
st1 {v0.16b}, [x0]

我不认为 AArch64 binutils 有任何方法支持 Apple 语法,所以我认为可用的解决方案仅限于 "fix the code up manually" 或 "try Clang/LLVM instead"。