linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: linuxppc-dev@lists.ozlabs.org, jbglaw@lug-owl.de,
	Nicholas Piggin <npiggin@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 2/5] powerpc: Pass correct CPU reference to assembler
Date: Tue, 20 Dec 2022 21:14:30 +0100	[thread overview]
Message-ID: <20221220201430.xopin6ezcdk5f66k@pali> (raw)
In-Reply-To: <758ad54128fa9dd2fdedc4c511592111cbded900.1671475543.git.christophe.leroy@csgroup.eu>

On Monday 19 December 2022 19:45:57 Christophe Leroy wrote:
> Jan-Benedict reported issue with building ppc64e_defconfig
> with mainline GCC work:
> 
>   powerpc64-linux-gcc -Wp,-MMD,arch/powerpc/kernel/vdso/.gettimeofday-64.o.d -nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated  -I./include -I./arch/powerpc/include/uapi -I./arch/powerpc/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -D__KERNEL__ -I ./arch/powerpc -DHAVE_AS_ATHIGH=1 -fmacro-prefix-map=./= -D__ASSEMBLY__ -fno-PIE -m64 -Wl,-a64 -mabi=elfv1 -Wa,-me500 -Wa,-me500mc -mabi=elfv1 -mbig-endian    -Wl,-soname=linux-vdso64.so.1 -D__VDSO64__ -s -c -o arch/powerpc/kernel/vdso/gettimeofday-64.o arch/powerpc/kernel/vdso/gettimeofday.S
> 	arch/powerpc/kernel/vdso/gettimeofday.S: Assembler messages:
> 	arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `stdu'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `stdu'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `std'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `std'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `ld'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `ld'
> 	...
> 	make[1]: *** [arch/powerpc/kernel/vdso/Makefile:76: arch/powerpc/kernel/vdso/gettimeofday-64.o] Error 1
> 	make: *** [arch/powerpc/Makefile:387: vdso_prepare] Error 2
> 
> This is due to assembler being called with -me500mc which is
> a 32 bits target.
> 
> The problem comes from the fact that CONFIG_PPC_E500MC is selected for
> both the e500mc (32 bits) and the e5500 (64 bits), and therefore the
> following makefile rule is wrong:
> 
>   cpu-as-$(CONFIG_PPC_E500MC)    += $(call as-option,-Wa$(comma)-me500mc)
> 
> Today we have CONFIG_TARGET_CPU which provides the identification of the
> expected CPU, it is used for GCC. Once GCC knows the target CPU, it adds
> the correct CPU option to assembler, no need to add it explicitely.
> 
> With that change (And also commit 825eada7717c ("powerpc/64: Set
> default CPU in Kconfig")), it now is:
> 
>   powerpc64-linux-gcc -Wp,-MMD,arch/powerpc/kernel/vdso/.gettimeofday-64.o.d -nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated  -I./include -I./arch/powerpc/include/uapi -I./arch/powerpc/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -D__KERNEL__ -I ./arch/powerpc -DHAVE_AS_ATHIGH=1 -fmacro-prefix-map=./= -D__ASSEMBLY__ -fno-PIE -m64 -Wl,-a64 -mabi=elfv1 -mcpu=e500mc64 -mabi=elfv1 -mbig-endian    -Wl,-soname=linux-vdso64.so.1 -D__VDSO64__ -s -c -o arch/powerpc/kernel/vdso/gettimeofday-64.o arch/powerpc/kernel/vdso/gettimeofday.S
> 
> Reported-by: Jan-Benedict Glaw <jbglaw@lug-owl.de>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>

Acked-by: Pali Rohár <pali@kernel.org>

> ---
> v3: Remove -Wa,-mXXX completery as there are additional mismatches between -mcpu and -Wa-m (eg: 8540 vs e500). When given the proper -mcpu=, GCC gives the correct option to assembler.
> 
> v2: When target cpu is powerpc, the option to be used is -mppc
> 
> Commit 825eada7717c is in powerpc/next-test branch. Make sure the SHA doesn't change when it goes into powerpc/next
> ---
>  arch/powerpc/Makefile | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index bf5f0a998273..0f9f291895cb 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -201,18 +201,14 @@ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
>  # often slow when they are implemented at all
>  KBUILD_CFLAGS		+= $(call cc-option,-mno-string)
>  
> -cpu-as-$(CONFIG_40x)		+= -Wa,-m405
> -cpu-as-$(CONFIG_44x)		+= -Wa,-m440
>  cpu-as-$(CONFIG_ALTIVEC)	+= $(call as-option,-Wa$(comma)-maltivec)
> -cpu-as-$(CONFIG_PPC_E500)		+= -Wa,-me500
>  
>  # When using '-many -mpower4' gas will first try and find a matching power4
>  # mnemonic and failing that it will allow any valid mnemonic that GAS knows
>  # about. GCC will pass -many to GAS when assembling, clang does not.
>  # LLVM IAS doesn't understand either flag: https://github.com/ClangBuiltLinux/linux/issues/675
>  # but LLVM IAS only supports ISA >= 2.06 for Book3S 64 anyway...
> -cpu-as-$(CONFIG_PPC_BOOK3S_64)	+= $(call as-option,-Wa$(comma)-mpower4) $(call as-option,-Wa$(comma)-many)
> -cpu-as-$(CONFIG_PPC_E500MC)	+= $(call as-option,-Wa$(comma)-me500mc)
> +cpu-as-$(CONFIG_PPC_BOOK3S_64)	+= $(call as-option,-Wa$(comma)-many)
>  
>  KBUILD_AFLAGS += $(cpu-as-y)
>  KBUILD_CFLAGS += $(cpu-as-y)
> -- 
> 2.38.1
> 

  reply	other threads:[~2022-12-20 20:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-19 18:45 [PATCH v1 1/5] powerpc/64: Set default CPU in Kconfig Christophe Leroy
2022-12-19 18:45 ` [PATCH v1 2/5] powerpc: Pass correct CPU reference to assembler Christophe Leroy
2022-12-20 20:14   ` Pali Rohár [this message]
2022-12-19 18:45 ` [PATCH v1 3/5] powerpc/64: Replace -mcpu=e500mc64 by -mcpu=e5500 Christophe Leroy
2022-12-20 20:15   ` Pali Rohár
2023-02-01 23:46     ` Pali Rohár
2023-02-03 18:23       ` Christophe Leroy
2022-12-19 18:45 ` [PATCH v1 4/5] powerpc: Remove cpu-as-y completely Christophe Leroy
2022-12-20 20:15   ` Pali Rohár
2023-02-20  6:00   ` Michael Ellerman
2024-02-16 15:25     ` Christophe Leroy
2024-02-24 23:52       ` Michael Ellerman
2022-12-19 18:46 ` [PATCH v1 5/5] powerpc/epapr: Don't use wrteei on non booke Christophe Leroy
2022-12-20 20:21   ` Pali Rohár
2023-02-15 23:15     ` Pali Rohár
2022-12-20 20:13 ` [PATCH v1 1/5] powerpc/64: Set default CPU in Kconfig Pali Rohár
2023-02-20  3:53 ` Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221220201430.xopin6ezcdk5f66k@pali \
    --to=pali@kernel.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=jbglaw@lug-owl.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=npiggin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).