From: "Pali Rohár" <pali@kernel.org>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Arnd Bergmann <arnd@arndb.de>,
linux-kernel@vger.kernel.org, Nicholas Piggin <npiggin@gmail.com>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v1 2/5] powerpc/32: Don't always pass -mcpu=powerpc to the compiler
Date: Sat, 20 Aug 2022 12:55:10 +0200 [thread overview]
Message-ID: <20220820105510.psagglbbfyve53fc@pali> (raw)
In-Reply-To: <20220818174634.6nkzcztzn6uqcrzg@pali>
On Thursday 18 August 2022 19:46:34 Pali Rohár wrote:
> On Monday 11 July 2022 16:19:30 Christophe Leroy wrote:
> > Since commit 4bf4f42a2feb ("powerpc/kbuild: Set default generic
> > machine type for 32-bit compile"), when building a 32 bits kernel
> > with a bi-arch version of GCC, or when building a book3s/32 kernel,
> > the option -mcpu=powerpc is passed to GCC at all time, relying on it
> > being eventually overriden by a subsequent -mcpu=xxxx.
> >
> > But when building the same kernel with a 32 bits only version of GCC,
> > that is not done, relying on gcc being built with the expected default
> > CPU.
> >
> > This logic has two problems. First, it is a bit fragile to rely on
> > whether the GCC version is bi-arch or not, because today we can have
> > bi-arch versions of GCC configured with a 32 bits default. Second,
> > there are some versions of GCC which don't support -mcpu=powerpc,
> > for instance for e500 SPE-only versions.
> >
> > So, stop relying on this approximative logic and allow the user to
> > decide whether he/she wants to use the toolchain's default CPU or if
> > he/she wants to set one, and allow only possible CPUs based on the
> > selected target.
>
> Hello! Exactly same issue is still in file arch/powerpc/boot/Makefile:
>
> ifdef CONFIG_PPC64_BOOT_WRAPPER
> ifdef CONFIG_CPU_LITTLE_ENDIAN
> BOOTCFLAGS += -m64 -mcpu=powerpc64le
> else
> BOOTCFLAGS += -m64 -mcpu=powerpc64
> endif
> else
> BOOTCFLAGS += -m32 -mcpu=powerpc
> endif
>
> It cause compile error:
>
> make ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnuspe- mpc85xx_smp_defconfig uImage
> ...
> BOOTAS arch/powerpc/boot/crt0.o
> powerpc-linux-gnuspe-gcc: error: unrecognized argument in option ‘-mcpu=powerpc’
> powerpc-linux-gnuspe-gcc: note: valid arguments to ‘-mcpu=’ are: 8540 8548 native
> make[1]: *** [arch/powerpc/boot/Makefile:231: arch/powerpc/boot/crt0.o] Error 1
Now I have sent patch for this issue:
https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20220820105200.30425-1-pali@kernel.org/
> > Reported-by: Pali Rohár <pali@kernel.org>
> > Tested-by: Pali Rohár <pali@kernel.org>
> > Reviewed-by: Arnd Bergmann <arnd@arndb.de>
> > Cc: Segher Boessenkool <segher@kernel.crashing.org>
> > Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> > ---
> > arch/powerpc/Makefile | 26 +-------------------------
> > arch/powerpc/platforms/Kconfig.cputype | 21 ++++++++++++++++++---
> > 2 files changed, 19 insertions(+), 28 deletions(-)
WARNING: multiple messages have this Message-ID (diff)
From: "Pali Rohár" <pali@kernel.org>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
Arnd Bergmann <arnd@arndb.de>,
Segher Boessenkool <segher@kernel.crashing.org>
Subject: Re: [PATCH v1 2/5] powerpc/32: Don't always pass -mcpu=powerpc to the compiler
Date: Sat, 20 Aug 2022 12:55:10 +0200 [thread overview]
Message-ID: <20220820105510.psagglbbfyve53fc@pali> (raw)
In-Reply-To: <20220818174634.6nkzcztzn6uqcrzg@pali>
On Thursday 18 August 2022 19:46:34 Pali Rohár wrote:
> On Monday 11 July 2022 16:19:30 Christophe Leroy wrote:
> > Since commit 4bf4f42a2feb ("powerpc/kbuild: Set default generic
> > machine type for 32-bit compile"), when building a 32 bits kernel
> > with a bi-arch version of GCC, or when building a book3s/32 kernel,
> > the option -mcpu=powerpc is passed to GCC at all time, relying on it
> > being eventually overriden by a subsequent -mcpu=xxxx.
> >
> > But when building the same kernel with a 32 bits only version of GCC,
> > that is not done, relying on gcc being built with the expected default
> > CPU.
> >
> > This logic has two problems. First, it is a bit fragile to rely on
> > whether the GCC version is bi-arch or not, because today we can have
> > bi-arch versions of GCC configured with a 32 bits default. Second,
> > there are some versions of GCC which don't support -mcpu=powerpc,
> > for instance for e500 SPE-only versions.
> >
> > So, stop relying on this approximative logic and allow the user to
> > decide whether he/she wants to use the toolchain's default CPU or if
> > he/she wants to set one, and allow only possible CPUs based on the
> > selected target.
>
> Hello! Exactly same issue is still in file arch/powerpc/boot/Makefile:
>
> ifdef CONFIG_PPC64_BOOT_WRAPPER
> ifdef CONFIG_CPU_LITTLE_ENDIAN
> BOOTCFLAGS += -m64 -mcpu=powerpc64le
> else
> BOOTCFLAGS += -m64 -mcpu=powerpc64
> endif
> else
> BOOTCFLAGS += -m32 -mcpu=powerpc
> endif
>
> It cause compile error:
>
> make ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnuspe- mpc85xx_smp_defconfig uImage
> ...
> BOOTAS arch/powerpc/boot/crt0.o
> powerpc-linux-gnuspe-gcc: error: unrecognized argument in option ‘-mcpu=powerpc’
> powerpc-linux-gnuspe-gcc: note: valid arguments to ‘-mcpu=’ are: 8540 8548 native
> make[1]: *** [arch/powerpc/boot/Makefile:231: arch/powerpc/boot/crt0.o] Error 1
Now I have sent patch for this issue:
https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20220820105200.30425-1-pali@kernel.org/
> > Reported-by: Pali Rohár <pali@kernel.org>
> > Tested-by: Pali Rohár <pali@kernel.org>
> > Reviewed-by: Arnd Bergmann <arnd@arndb.de>
> > Cc: Segher Boessenkool <segher@kernel.crashing.org>
> > Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> > ---
> > arch/powerpc/Makefile | 26 +-------------------------
> > arch/powerpc/platforms/Kconfig.cputype | 21 ++++++++++++++++++---
> > 2 files changed, 19 insertions(+), 28 deletions(-)
next prev parent reply other threads:[~2022-08-20 10:55 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-11 14:19 [PATCH v1 1/5] powerpc/32: Do not allow selection of e5500 or e6500 CPUs on PPC32 Christophe Leroy
2022-07-11 14:19 ` Christophe Leroy
2022-07-11 14:19 ` [PATCH v1 2/5] powerpc/32: Don't always pass -mcpu=powerpc to the compiler Christophe Leroy
2022-07-11 14:19 ` Christophe Leroy
2022-07-11 16:50 ` Segher Boessenkool
2022-07-11 16:50 ` Segher Boessenkool
2022-08-18 17:46 ` Pali Rohár
2022-08-18 17:46 ` Pali Rohár
2022-08-20 10:55 ` Pali Rohár [this message]
2022-08-20 10:55 ` Pali Rohár
2022-07-11 14:19 ` [PATCH v1 3/5] powerpc/405: Fix build failure with GCC 12 (unrecognized opcode: `wrteei') Christophe Leroy
2022-07-11 14:19 ` Christophe Leroy
2022-07-11 14:19 ` [PATCH v1 4/5] powerpc/44x: " Christophe Leroy
2022-07-11 14:19 ` Christophe Leroy
2022-07-11 15:05 ` Arnd Bergmann
2022-07-11 15:05 ` Arnd Bergmann
2022-07-11 15:49 ` Christophe Leroy
2022-07-11 15:49 ` Christophe Leroy
2022-07-11 17:12 ` Segher Boessenkool
2022-07-11 17:12 ` Segher Boessenkool
2022-07-11 14:19 ` [PATCH v1 5/5] powerpc/64e: " Christophe Leroy
2022-07-11 14:19 ` Christophe Leroy
2022-12-11 17:32 ` Pali Rohár
2022-12-11 17:32 ` Pali Rohár
2022-12-12 7:36 ` Christophe Leroy
2022-12-12 7:36 ` Christophe Leroy
2022-12-12 10:27 ` Michael Ellerman
2022-12-12 10:27 ` Michael Ellerman
2022-07-11 16:39 ` [PATCH v1 1/5] powerpc/32: Do not allow selection of e5500 or e6500 CPUs on PPC32 Segher Boessenkool
2022-07-11 16:39 ` Segher Boessenkool
2022-07-11 17:42 ` Christophe Leroy
2022-07-11 17:42 ` Christophe Leroy
2022-07-29 13:02 ` 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=20220820105510.psagglbbfyve53fc@pali \
--to=pali@kernel.org \
--cc=arnd@arndb.de \
--cc=christophe.leroy@csgroup.eu \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.