Created attachment 14742 [details] original source file Clang HEAD, Linux HEAD used. we fail to compile arch/x86/crypto/aes_ctrby8_avx-x86_64.S (crypto AES_NI implementation). arch/x86/crypto/aes_ctrby8_avx-x86_64.S attached. AS [M] arch/x86/crypto/aes_ctrby8_avx-x86_64.o arch/x86/crypto/aes_ctrby8_avx-x86_64.S: Assembler messages: arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: bad expression arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: junk at end of line, first unrecognized character is `x' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: too many memory references for `vaesenc' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: bad expression arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: junk at end of line, first unrecognized character is `x' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: too many memory references for `vaesenc' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: bad expression arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: junk at end of line, first unrecognized character is `x' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: too many memory references for `vaesenc' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: bad expression arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: junk at end of line, first unrecognized character is `x' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: too many memory references for `vaesenc' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: bad expression arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: junk at end of line, first unrecognized character is `x' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: too many memory references for `vaesenc' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: bad expression
This also fails when not using the integrated as. This was called a clang preprocessor bug here: https://lists.linuxfoundation.org/pipermail/llvmlinux/2014-December/001128.html I'm not sure if they ever reported it. If you change aes_ctrby8_avx-x86_64.S from #define XMM(i) CONCAT(%xmm, i) to #define XMM(i) CONCAT(%xmm,i) you get a different set of errors: [~/llvmlinux/kernel] dev% /home/rich/ellcc/bin/ecc -Wp,-MD,arch/x86/crypto/.aes_ctrby8_avx-x86_64.o.d -isystem /home/rich/ellcc/bin/../libecc/include -I./arch/x86/include -Iarch/x86/include/generated/uapi -Iarch/x86/include/generated -Iinclude -I./arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -Qunused-arguments -D__ASSEMBLY__ -no-integrated-as -m64 -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -Wa,-gdwarf-2 -c -o arch/x86/crypto/aes_ctrby8_avx-x86_64.o arch/x86/crypto/aes_ctrby8_avx-x86_64.S arch/x86/crypto/aes_ctrby8_avx-x86_64.S: Assembler messages: arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:552: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:565: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:565: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:565: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:565: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:565: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:565: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:565: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:565: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:578: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:578: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:578: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:578: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:578: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:578: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:578: Error: missing ')' arch/x86/crypto/aes_ctrby8_avx-x86_64.S:578: Error: missing ')' ecc: error: assembler command failed with exit code 1 (use -v to see invocation) [~/llvmlinux/kernel] dev%
The original error still happens with clang 4.0 (post-rc1 release_40 branch, rev. 293332), but getting rid of the space in the XMM macro as described in comment 1 "fixes" it now.
It looks now like the error for this file with Clang's integrated assembler is different. With this patch https://lore.kernel.org/patchwork/patch/1261086/ (not accepted yet), I can assemble arch/x86/crypto/aes_ctrby8_avx-x86_64.o with Clang's integrated assembler. With that and https://lore.kernel.org/lkml/20200624051538.5355-1-sedat.dilek@gmail.com/ (not accepted yet), I can assemble that whole config CONFIG_CRYPTO_AES_NI_INTEL=y with Clang's IA.
Patch accepted in cryptodev-2.6.git: [1] https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git/commit/?id=3347c8a079d67af21760a78cc5f2abbcf06d9571
Second patch accepted in cryptodev-2.6.git [1] https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git/commit/?id=44069737ac9625a0f02f0f7f5ab96aae4cd819bc
Both patches now in Linus Git. crypto: aesni - add compatibility with IAS (see [1]) crypto: aesni - Fix build with LLVM_IAS=1 (see [2]) Please close, thanks. [1] https://git.kernel.org/linus/44069737ac9625a0f02f0f7f5ab96aae4cd819bc [2] https://git.kernel.org/linus/3347c8a079d67af21760a78cc5f2abbcf06d9571