Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Linux kernel] clang fails to compile aes_ni in linux kernel with integrated-as used #24868

Closed
llvmbot opened this issue Aug 19, 2015 · 7 comments
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 19, 2015

Bugzilla Link 24494
Resolution FIXED
Resolved on Aug 07, 2020 12:35
Version trunk
OS Linux
Blocks #4440
Attachments original source file
Reporter LLVM Bugzilla Contributor
CC @jcai19,@nickdesaulniers,@pageexec,@zygoloid,@tinti

Extended Description

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

@llvmbot
Copy link
Collaborator Author

llvmbot commented Oct 23, 2015

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%

@llvmbot
Copy link
Collaborator Author

llvmbot commented Feb 2, 2017

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.

@nickdesaulniers
Copy link
Member

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.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jul 10, 2020

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jul 10, 2020

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 7, 2020

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

@edwintorok
Copy link
Contributor

mentioned in issue #4440

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category
Projects
None yet
Development

No branches or pull requests

3 participants