Skip to contentSkip to conversation

arch/Config.in.powerpc: disable 64bits only target for PowerPC target variant

PATCH In review Romain Naour 2 participants 3 messages Sep 6, 2022 – Sep 7, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arch/Config.in.powerpc: disable 64bits only target for PowerPC target variant

It turn out that some PowerPC variant are actually 64bits only and fail to build an internal toolchain (fail on glibc, uClibc-ng or musl build).

Example of defconfig fragment:
BR2_powerpc=y
BR2_powerpc_power4=y

Looking at gcc source code for PowerPC (rs6000) cpu definition allow to understand which cpu target are 64bits and affected by this issue. As soon as the cpu target is defined with MASK_POWERPC64 flag, it means that gcc will generate binaries for PowerPC64 while Buildroot will try to build for PowerPC.

This issue is now noticed thanks to the autobuilder script that generates fully random configurations that can trigger configurations that were not tested before.

Fixes:
[musl: powerpc/970]
http://autobuild.buildroot.net/results/184/18405f28f248a6a20b4373625bdfaacad2e351f1
[musl: powerpc/power4]
http://autobuild.buildroot.net/results/7ca/7cac82105590d90e964645464df1078dc1d3c0b9
[musl powerpc/power5]
http://autobuild.buildroot.net/results/cbf/cbfb2307c794d2f80a619915848fce8e790ee727
[musl: powerpc/power7]
http://autobuild.buildroot.net/results/c3d/c3d21c3bcb553ea414d2127798e6e6258885f9d6
[musl powerpc/power8]
http://autobuild.buildroot.net/results/e39/e39dd419e4a62f86fa748a56ccd028d83544f651
[musl powerpc/630]
http://autobuild.buildroot.net/results/bac/bac55dde44586d702bb0b4e6b22024e6fa24cccf
[musl powerpc/670]
http://autobuild.buildroot.net/results/ebb/ebbea8d0b678157c690243f453c50467589c8d25

[glibc: powerpc/power4]
http://autobuild.buildroot.net/results/7b6/7b67eeedf8bbda1fc35007bd5d56ea2ecd14a044
[glibc: powerpc/power8]
http://autobuild.buildroot.net/results/385/38564e11eb7920da30d7496c6eec36057c8cb1d5
...

[uclibc: powerpc/power4]
http://autobuild.buildroot.net/results/ccf/ccfadafb81e6a9a3d78444f4b97c4f0b18090b43
[uclibc: powerpc/power8]
http://autobuild.buildroot.net/results/286/2866e30e7111de1fd4da24f6f37219c80c99635c
...

[1] https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/rs6000/rs6000-cpus.def;h=963947f693929b3bf2dcd08b50b60ebb1acf52f0#l200

---
 arch/Config.in.powerpc | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
arch/Config.in.powerpc +20 -0
index c48edd3bb4..b321dd2d4c 100644
@@ -66,10 +66,14 @@ config BR2_powerpc_604e
 	depends on !BR2_ARCH_IS_64
 config BR2_powerpc_620
 	bool "620"
+	# gcc support only powerpc64 target
+	depends on BR2_ARCH_IS_64
 	# No C library supports this variant on ppc64le
 	depends on !BR2_powerpc64le
 config BR2_powerpc_630
 	bool "630"
+	# gcc support only powerpc64 target
+	depends on BR2_ARCH_IS_64
 	# No C library supports this variant on ppc64le
 	depends on !BR2_powerpc64le
 config BR2_powerpc_740
@@ -97,6 +101,8 @@ config BR2_powerpc_860
 	depends on !BR2_ARCH_IS_64
 config BR2_powerpc_970
 	bool "970"
+	# gcc support only powerpc64 target
+	depends on BR2_ARCH_IS_64
 	select BR2_POWERPC_CPU_HAS_ALTIVEC
 config BR2_powerpc_8540
 	bool "8540 / e500v1"
@@ -117,28 +123,42 @@ config BR2_powerpc_e500mc
 	depends on !BR2_ARCH_IS_64
 config BR2_powerpc_e5500
 	bool "e5500"
+	# gcc support only powerpc64 target
+	depends on BR2_ARCH_IS_64
 	depends on !BR2_powerpc64le
 config BR2_powerpc_e6500
 	bool "e6500"
+	# gcc support only powerpc64 target
+	depends on BR2_ARCH_IS_64
 	depends on !BR2_powerpc64le
 	select BR2_POWERPC_CPU_HAS_ALTIVEC
 config BR2_powerpc_power4
 	bool "power4"
+	# gcc support only powerpc64 target
+	depends on BR2_ARCH_IS_64
 	# No C library supports this variant on ppc64le
 	depends on !BR2_powerpc64le
 config BR2_powerpc_power5
 	bool "power5"
+	# gcc support only powerpc64 target
+	depends on BR2_ARCH_IS_64
 	# No C library supports this variant on ppc64le
 	depends on !BR2_powerpc64le
 config BR2_powerpc_power6
 	bool "power6"
+	# gcc support only powerpc64 target
+	depends on BR2_ARCH_IS_64
 	select BR2_POWERPC_CPU_HAS_ALTIVEC
 config BR2_powerpc_power7
 	bool "power7"
+	# gcc support only powerpc64 target
+	depends on BR2_ARCH_IS_64
 	select BR2_POWERPC_CPU_HAS_ALTIVEC
 	select BR2_POWERPC_CPU_HAS_VSX
 config BR2_powerpc_power8
 	bool "power8"
+	# gcc support only powerpc64 target
+	depends on BR2_ARCH_IS_64
 	select BR2_POWERPC_CPU_HAS_ALTIVEC
 	select BR2_POWERPC_CPU_HAS_VSX
 endchoice
Signature · 6 lines
2.37.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Romain, All,

On 2022-09-06 22:34 +0200, Romain Naour spake thusly:

Quoted 3 lines

It turn out that some PowerPC variant are actually 64bits only and fail to build an internal toolchain (fail on glibc, uClibc-ng or musl build).

[--SNIP--]

arch/Config.in.powerpc config BR2_powerpc_604e · line 72

Quoted 12 lines
arch/Config.in.powerpc +2 -0
index c48edd3bb4..b321dd2d4c 100644
@@ -66,10 +66,14 @@ config BR2_powerpc_604e
 	depends on !BR2_ARCH_IS_64
 config BR2_powerpc_620
 	bool "620"
+	# gcc support only powerpc64 target
+	depends on BR2_ARCH_IS_64
 	# No C library supports this variant on ppc64le
 	depends on !BR2_powerpc64le

As Thomas previously suggested, let's use positive logic:

    # gcc support only powerpc64 target, and
    # no C library supports this variant on ppc64le
    depends on BR2_powerpc64

And so on for the others.

Let's try and get simpler dependencies, which make it obvious under what conditions each CPU variant is actually available.

Also, I think Joel's series [0] had even more changes in that area, and it would be so nice to see an updated revision.

[0] https://lore.kernel.org/buildroot/[email protected]/

Regards,
Yann E. MORIN.

Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Hello Yann, All,

Le 07/09/2022 à 09:30, Yann E. MORIN a écrit :

Quoted 26 lines

Romain, All,

On 2022-09-06 22:34 +0200, Romain Naour spake thusly:

Quoted 3 lines

It turn out that some PowerPC variant are actually 64bits only and fail to build an internal toolchain (fail on glibc, uClibc-ng or musl build).

[--SNIP--]

arch/Config.in.powerpc config BR2_powerpc_604e · line 72

Quoted 12 lines
arch/Config.in.powerpc +2 -0
index c48edd3bb4..b321dd2d4c 100644
@@ -66,10 +66,14 @@ config BR2_powerpc_604e
 	depends on !BR2_ARCH_IS_64
 config BR2_powerpc_620
 	bool "620"
+	# gcc support only powerpc64 target
+	depends on BR2_ARCH_IS_64
 	# No C library supports this variant on ppc64le
 	depends on !BR2_powerpc64le

As Thomas previously suggested, let's use positive logic:

    # gcc support only powerpc64 target, and
    # no C library supports this variant on ppc64le
    depends on BR2_powerpc64
Quoted 7 lines

And so on for the others.

Let's try and get simpler dependencies, which make it obvious under what conditions each CPU variant is actually available.

Also, I think Joel's series [0] had even more changes in that area, and it would be so nice to see an updated revision.

Sorry I didn't remember of this patch series (more one month ago) and marked changes requested. Actually I was not listening to the mailing list at that time due to vacations :p

Joel, can you resend your series and include all the link I provided in my commit log?

Best regards,
Romain

Quoted 6 lines

[0] https://lore.kernel.org/buildroot/[email protected]/

Regards,
Yann E. MORIN.

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot