Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [git commit] package/gcc: fix powerpc toolchain issues with 64-bit capable cores
@ 2023-08-26 19:51 Thomas Petazzoni via buildroot
  2023-09-13 19:27 ` Peter Korsgaard
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-08-26 19:51 UTC (permalink / raw)
  To: buildroot

commit: https://git.buildroot.net/buildroot/commit/?id=5acaac7122945c7588cf2328d928e1d4fb6488dd
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

Some of the powerpc CPUs supported by Buildroot are dual mode CPUs,
which means 32 Bit and 64 Bit mode is supported, and for any 64-bit
capable CPU, GCC defaults to using 64-bit, even if the toolchain tuple
starts with powerpc-* (and not powerpc64-*). This causes issues when
building toolchains with uClibc or musl.

In order to resolve this, we force GCC to understand we want to
generate 32-bit code, using the --with-cpu-32 option.

See here the gcc documentation for details about --with-cpu-32:
https://gcc.gnu.org/install/configure.html

See here for a discussion on the musl mailinglist about the error:
https://inbox.vuxu.org/musl/20220722162900.GB1320090@port70.net/

Fixes:
 - http://autobuild.buildroot.net/results/450/4509d8cfb7d99beb4ef023f170490def1d90f92c
 - http://autobuild.buildroot.net/results/654/6545a464d49f9f3c6740a5208cfad7f09ec4cb8b
 - http://autobuild.buildroot.net/results/cf8/cf866d5320b069eb1e8b4f05e8e58de0ad2ec7b5

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 package/gcc/gcc.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
index 1ecbf7e9b4..3050229176 100644
--- a/package/gcc/gcc.mk
+++ b/package/gcc/gcc.mk
@@ -225,9 +225,17 @@ endif
 ifneq ($(GCC_TARGET_FP32_MODE),)
 HOST_GCC_COMMON_CONF_OPTS += --with-fp-32="$(GCC_TARGET_FP32_MODE)"
 endif
+
+# musl/uClibc-ng does not work with biarch powerpc toolchains, we
+# need to configure gcc explicitely for 32 Bit for CPU's supporting
+# 64 Bit and 32 Bit
 ifneq ($(GCC_TARGET_CPU),)
+ifeq ($(BR2_powerpc),y)
+HOST_GCC_COMMON_CONF_OPTS += --with-cpu-32=$(GCC_TARGET_CPU)
+else
 HOST_GCC_COMMON_CONF_OPTS += --with-cpu=$(GCC_TARGET_CPU)
 endif
+endif
 
 ifneq ($(GCC_TARGET_FPU),)
 HOST_GCC_COMMON_CONF_OPTS += --with-fpu=$(GCC_TARGET_FPU)
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Buildroot] [git commit] package/gcc: fix powerpc toolchain issues with 64-bit capable cores
  2023-08-26 19:51 [Buildroot] [git commit] package/gcc: fix powerpc toolchain issues with 64-bit capable cores Thomas Petazzoni via buildroot
@ 2023-09-13 19:27 ` Peter Korsgaard
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Korsgaard @ 2023-09-13 19:27 UTC (permalink / raw)
  To: Thomas Petazzoni via buildroot; +Cc: Thomas Petazzoni

>>>>> "Thomas" == Thomas Petazzoni via buildroot <buildroot@buildroot.org> writes:

 > commit: https://git.buildroot.net/buildroot/commit/?id=5acaac7122945c7588cf2328d928e1d4fb6488dd
 > branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

 > Some of the powerpc CPUs supported by Buildroot are dual mode CPUs,
 > which means 32 Bit and 64 Bit mode is supported, and for any 64-bit
 > capable CPU, GCC defaults to using 64-bit, even if the toolchain tuple
 > starts with powerpc-* (and not powerpc64-*). This causes issues when
 > building toolchains with uClibc or musl.

 > In order to resolve this, we force GCC to understand we want to
 > generate 32-bit code, using the --with-cpu-32 option.

 > See here the gcc documentation for details about --with-cpu-32:
 > https://gcc.gnu.org/install/configure.html

 > See here for a discussion on the musl mailinglist about the error:
 > https://inbox.vuxu.org/musl/20220722162900.GB1320090@port70.net/

 > Fixes:
 >  - http://autobuild.buildroot.net/results/450/4509d8cfb7d99beb4ef023f170490def1d90f92c
 >  - http://autobuild.buildroot.net/results/654/6545a464d49f9f3c6740a5208cfad7f09ec4cb8b
 >  - http://autobuild.buildroot.net/results/cf8/cf866d5320b069eb1e8b4f05e8e58de0ad2ec7b5

 > Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
 > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Committed to 2023.02.x and 2023.05.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-09-13 19:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-26 19:51 [Buildroot] [git commit] package/gcc: fix powerpc toolchain issues with 64-bit capable cores Thomas Petazzoni via buildroot
2023-09-13 19:27 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox