LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 24494 - [Linux kernel] clang fails to compile aes_ni in linux kernel with integrated-as used
Summary: [Linux kernel] clang fails to compile aes_ni in linux kernel with integrated-...
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: -New Bugs (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Unassigned Clang Bugs
URL: https://github.com/ClangBuiltLinux/li...
Keywords:
Depends on:
Blocks: 4068
  Show dependency tree
 
Reported: 2015-08-18 19:35 PDT by Jan-Simon Möller
Modified: 2020-08-07 12:35 PDT (History)
12 users (show)

See Also:
Fixed By Commit(s):


Attachments
original source file (12.21 KB, text/x-asm)
2015-08-18 19:35 PDT, Jan-Simon Möller
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan-Simon Möller 2015-08-18 19:35:14 PDT
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
Comment 1 Richard Pennington 2015-10-23 14:58:28 PDT
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%
Comment 2 Bernhard Rosenkraenzer 2017-02-01 17:50:49 PST
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.
Comment 3 Nick Desaulniers 2020-06-26 13:43:29 PDT
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.
Comment 6 SedatDilek 2020-08-07 12:11:23 PDT
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