Subject: Re: [PATCH v3] powerpc/64: Option to use ELF V2 ABI for big-endian kernels

From: Michael Ellerman <[email-masked]>
Date: Mon, 18 May 2020 16:35:22 +1000

Nicholas Piggin <[email-masked]> writes:
> Provide an option to build big-endian kernels using the ELF V2 ABI. This works
> on GCC and clang (since about 2014). it is is not officially supported by the
> GNU toolchain, but it can give big-endian kernels  some useful advantages of
> the V2 ABI (e.g., less stack usage).
>
> Reviewed-by: Segher Boessenkool <[email-masked]>
> Signed-off-by: Nicholas Piggin <[email-masked]>
> ---
> Since v1:
> - Improved the override flavour name suggested by Segher.
> - Improved changelog wording.
>
> Since v2:
> - Improved changelog, help text, to use the name ELF V2 ABI in the spec,
>   and clarify things a bit more, suggested by Segher.
> - For option name, match the ELF_ABI_v1/2 which is already in the kernel.
> - Prefix options with PPC64_ to avoid arch clashes or confusion.
> - "elfv2" is the toolchain name of the ABI, so I kept that in the crypto
>   perl scripts.
>
>  arch/powerpc/Kconfig            | 21 +++++++++++++++++++++
>  arch/powerpc/Makefile           | 15 ++++++++++-----
>  arch/powerpc/boot/Makefile      |  4 ++++
>  drivers/crypto/vmx/Makefile     |  8 ++++++--
>  drivers/crypto/vmx/ppc-xlate.pl | 10 ++++++----
>  5 files changed, 47 insertions(+), 11 deletions(-)

This doesn't build with clang:

  /tmp/aesp8-ppc-dad624.s: Assembler messages:
  /tmp/aesp8-ppc-dad624.s: Error: .size expression for aes_p8_set_encrypt_key does not evaluate to a constant
  /tmp/aesp8-ppc-dad624.s: Error: .size expression for aes_p8_set_decrypt_key does not evaluate to a constant
  /tmp/aesp8-ppc-dad624.s: Error: .size expression for aes_p8_encrypt does not evaluate to a constant
  /tmp/aesp8-ppc-dad624.s: Error: .size expression for aes_p8_decrypt does not evaluate to a constant
  /tmp/aesp8-ppc-dad624.s: Error: .size expression for aes_p8_cbc_encrypt does not evaluate to a constant
  /tmp/aesp8-ppc-dad624.s: Error: .size expression for aes_p8_ctr32_encrypt_blocks does not evaluate to a constant
  /tmp/aesp8-ppc-dad624.s: Error: .size expression for aes_p8_xts_encrypt does not evaluate to a constant
  /tmp/aesp8-ppc-dad624.s: Error: .size expression for aes_p8_xts_decrypt does not evaluate to a constant
  clang: error: assembler command failed with exit code 1 (use -v to see invocation)
  make[4]: *** [/linux/scripts/Makefile.build:349: drivers/crypto/vmx/aesp8-ppc.o] Error 1
  make[4]: *** Waiting for unfinished jobs....
  /tmp/ghashp8-ppc-01aa43.s: Assembler messages:
  /tmp/ghashp8-ppc-01aa43.s: Error: .size expression for gcm_init_p8 does not evaluate to a constant
  /tmp/ghashp8-ppc-01aa43.s: Error: .size expression for gcm_gmult_p8 does not evaluate to a constant
  /tmp/ghashp8-ppc-01aa43.s: Error: .size expression for gcm_ghash_p8 does not evaluate to a constant
  clang: error: assembler command failed with exit code 1 (use -v to see invocation)
  make[4]: *** [/linux/scripts/Makefile.build:349: drivers/crypto/vmx/ghashp8-ppc.o] Error 1
  make[3]: *** [/linux/scripts/Makefile.build:488: drivers/crypto/vmx] Error 2
  make[3]: *** Waiting for unfinished jobs....
  make[2]: *** [/linux/scripts/Makefile.build:488: drivers/crypto] Error 2
  make[2]: *** Waiting for unfinished jobs....
  /linux/drivers/scsi/qla2xxx/qla_nx2.c:3226:1: warning: stack frame size of 2208 bytes in function 'qla8044_collect_md_data' [-Wframe-larger-than=]
  qla8044_collect_md_data(struct scsi_qla_host *vha)
  ^
  1 warning generated.
  make[1]: *** [/linux/Makefile:1722: drivers] Error 2
  make: *** [Makefile:180: sub-make] Error 2

I'm not sure if it can work with clang at all, so I'm happy if the
option depends on !CC_IS_CLANG.

cheers