diff mbox series

package/gcc: Disable uclibc for powerpc64 and powerpc64le

Message ID 20220505100956.155737-1-joel@jms.id.au
State Rejected
Headers show
Series package/gcc: Disable uclibc for powerpc64 and powerpc64le | expand

Commit Message

Joel Stanley May 5, 2022, 10:09 a.m. UTC
uClibc-ng does not (and has never) supported the 64 bit powerpc
architecture.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
I'm a bit confused as to why uclibc was ever an option. Perhaps I missed
something! I did a search of the mailing list archive and the best I
found was this post from Thomas:

 https://lore.kernel.org/buildroot/20160817193721.0cc1466d@free-electrons.com/

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 package/gcc/Config.in.host | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Arnout Vandecappelle May 5, 2022, 7:45 p.m. UTC | #1
On 05/05/2022 12:09, Joel Stanley wrote:
> uClibc-ng does not (and has never) supported the 64 bit powerpc
> architecture.

  Exactly, that's why we have

config BR2_TOOLCHAIN_BUILDROOT_UCLIBC
	bool "uClibc-ng"
	depends on BR2_aarch64 || BR2_aarch64_be || BR2_arcle   || BR2_arceb  || \
		   BR2_arm     || BR2_armeb    || \
		   BR2_i386    || BR2_m68k   || BR2_microblaze || \
		   BR2_mips    || BR2_mipsel || BR2_mips64 || BR2_mips64el || \
		   BR2_or1k    || BR2_powerpc || BR2_RISCV_64 || \
		   BR2_sh4     || BR2_sh4eb   || BR2_sparc || BR2_xtensa || \
		   BR2_x86_64

  Can you give a concrete defconfig where it is possible to select uClibc for 
powerpc64?

  Assuming this is a mistake, I've marked as Rejected.

> 
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
> I'm a bit confused as to why uclibc was ever an option. Perhaps I missed
> something! I did a search of the mailing list archive and the best I
> found was this post from Thomas:
> 
>   https://lore.kernel.org/buildroot/20160817193721.0cc1466d@free-electrons.com/
> 
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
>   package/gcc/Config.in.host | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
> index a1fe192d3a24..3364860ec7a4 100644
> --- a/package/gcc/Config.in.host
> +++ b/package/gcc/Config.in.host
> @@ -31,6 +31,8 @@ config BR2_GCC_VERSION_9_X
>   	# upstream gcc. C-SKY gcc upstream support not tested
>   	# with upstream binutils and glibc.
>   	depends on !BR2_csky
> +	# 64 bit powerpc is not supported by uclibc
> +	depends on !(BR2_TOOLCHAIN_USES_UCLIBC && (BR2_powerpc64 || BR2_powerpc64le))

  This isn't the way to do that - the result would be that if you have uClibc 
selected, there is no choice option available for GCC. You have to do it in the 
uClibc config (like it is now).

  Regards,
  Arnout

>   	select BR2_TOOLCHAIN_GCC_AT_LEAST_9
>   
>   config BR2_GCC_VERSION_10_X
> @@ -43,6 +45,8 @@ config BR2_GCC_VERSION_10_X
>   	# upstream gcc. C-SKY gcc upstream support not tested
>   	# with upstream binutils and glibc.
>   	depends on !BR2_csky
> +	# 64 bit powerpc is not supported by uclibc
> +	depends on !(BR2_TOOLCHAIN_USES_UCLIBC && (BR2_powerpc64 || BR2_powerpc64le))
>   	select BR2_TOOLCHAIN_GCC_AT_LEAST_10
>   
>   config BR2_GCC_VERSION_11_X
> @@ -54,6 +58,8 @@ config BR2_GCC_VERSION_11_X
>   	# that need to be reverted since gcc 8.4, 9.3 and 10.1.
>   	# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98784
>   	depends on !BR2_sparc
> +	# 64 bit powerpc is not supported by uclibc
> +	depends on !(BR2_TOOLCHAIN_USES_UCLIBC && (BR2_powerpc64 || BR2_powerpc64le))
>   	select BR2_TOOLCHAIN_GCC_AT_LEAST_11
>   
>   endchoice
Yann E. MORIN May 5, 2022, 7:55 p.m. UTC | #2
Joel, All,

On 2022-05-05 19:39 +0930, Joel Stanley spake thusly:
> uClibc-ng does not (and has never) supported the 64 bit powerpc
> architecture.
> 
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
> I'm a bit confused as to why uclibc was ever an option. Perhaps I missed
> something! I did a search of the mailing list archive and the best I
> found was this post from Thomas:
> 
>  https://lore.kernel.org/buildroot/20160817193721.0cc1466d@free-electrons.com/
> 
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
>  package/gcc/Config.in.host | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
> index a1fe192d3a24..3364860ec7a4 100644
> --- a/package/gcc/Config.in.host
> +++ b/package/gcc/Config.in.host
> @@ -31,6 +31,8 @@ config BR2_GCC_VERSION_9_X
>  	# upstream gcc. C-SKY gcc upstream support not tested
>  	# with upstream binutils and glibc.
>  	depends on !BR2_csky
> +	# 64 bit powerpc is not supported by uclibc
> +	depends on !(BR2_TOOLCHAIN_USES_UCLIBC && (BR2_powerpc64 || BR2_powerpc64le))

This is not the proper place to put this limitation. Instead, it should
be added to toolchain/toolchain-buildroot/Config.in so that uClibc is
not ever selectable for powerpc64.

Except this is already the case:

   28 config BR2_TOOLCHAIN_BUILDROOT_UCLIBC
   29     bool "uClibc-ng"
   30     depends on BR2_aarch64 || BR2_aarch64_be || BR2_arcle   || BR2_arceb  || \
   31            BR2_arm     || BR2_armeb    || \
   32            BR2_i386    || BR2_m68k   || BR2_microblaze || \
   33            BR2_mips    || BR2_mipsel || BR2_mips64 || BR2_mips64el || \
   34            BR2_or1k    || BR2_powerpc || BR2_RISCV_64 || \
   35            BR2_sh4     || BR2_sh4eb   || BR2_sparc || BR2_xtensa || \
   36            BR2_x86_64

And indeed, when I enable either BR2_powerpc64 or BR2_powerpc64le, then
uclibc-ng is not selectable in the C library choice...

So now I am confused. Could you explain why you had to hide away the gcc
versions when uclibc-ng is selected? And how you even managed to select
uClibc-ng with powerpc64 to begine with? Can you share a defconfig that
exhibits the issue?

Regards,
Yann E. MORIN.

>  	select BR2_TOOLCHAIN_GCC_AT_LEAST_9
>  
>  config BR2_GCC_VERSION_10_X
> @@ -43,6 +45,8 @@ config BR2_GCC_VERSION_10_X
>  	# upstream gcc. C-SKY gcc upstream support not tested
>  	# with upstream binutils and glibc.
>  	depends on !BR2_csky
> +	# 64 bit powerpc is not supported by uclibc
> +	depends on !(BR2_TOOLCHAIN_USES_UCLIBC && (BR2_powerpc64 || BR2_powerpc64le))
>  	select BR2_TOOLCHAIN_GCC_AT_LEAST_10
>  
>  config BR2_GCC_VERSION_11_X
> @@ -54,6 +58,8 @@ config BR2_GCC_VERSION_11_X
>  	# that need to be reverted since gcc 8.4, 9.3 and 10.1.
>  	# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98784
>  	depends on !BR2_sparc
> +	# 64 bit powerpc is not supported by uclibc
> +	depends on !(BR2_TOOLCHAIN_USES_UCLIBC && (BR2_powerpc64 || BR2_powerpc64le))
>  	select BR2_TOOLCHAIN_GCC_AT_LEAST_11
>  
>  endchoice
> -- 
> 2.35.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
Joel Stanley May 9, 2022, 7:59 a.m. UTC | #3
On Thu, 5 May 2022 at 19:55, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
>
> Joel, All,
>
> On 2022-05-05 19:39 +0930, Joel Stanley spake thusly:
> > uClibc-ng does not (and has never) supported the 64 bit powerpc
> > architecture.
> >
> > Signed-off-by: Joel Stanley <joel@jms.id.au>
> > ---
> > I'm a bit confused as to why uclibc was ever an option. Perhaps I missed
> > something! I did a search of the mailing list archive and the best I
> > found was this post from Thomas:
> >
> >  https://lore.kernel.org/buildroot/20160817193721.0cc1466d@free-electrons.com/
> >
> > Signed-off-by: Joel Stanley <joel@jms.id.au>
> > ---
> >  package/gcc/Config.in.host | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
> > index a1fe192d3a24..3364860ec7a4 100644
> > --- a/package/gcc/Config.in.host
> > +++ b/package/gcc/Config.in.host
> > @@ -31,6 +31,8 @@ config BR2_GCC_VERSION_9_X
> >       # upstream gcc. C-SKY gcc upstream support not tested
> >       # with upstream binutils and glibc.
> >       depends on !BR2_csky
> > +     # 64 bit powerpc is not supported by uclibc
> > +     depends on !(BR2_TOOLCHAIN_USES_UCLIBC && (BR2_powerpc64 || BR2_powerpc64le))
>
> This is not the proper place to put this limitation. Instead, it should
> be added to toolchain/toolchain-buildroot/Config.in so that uClibc is
> not ever selectable for powerpc64.
>
> Except this is already the case:
>
>    28 config BR2_TOOLCHAIN_BUILDROOT_UCLIBC
>    29     bool "uClibc-ng"
>    30     depends on BR2_aarch64 || BR2_aarch64_be || BR2_arcle   || BR2_arceb  || \
>    31            BR2_arm     || BR2_armeb    || \
>    32            BR2_i386    || BR2_m68k   || BR2_microblaze || \
>    33            BR2_mips    || BR2_mipsel || BR2_mips64 || BR2_mips64el || \
>    34            BR2_or1k    || BR2_powerpc || BR2_RISCV_64 || \
>    35            BR2_sh4     || BR2_sh4eb   || BR2_sparc || BR2_xtensa || \
>    36            BR2_x86_64
>
> And indeed, when I enable either BR2_powerpc64 or BR2_powerpc64le, then
> uclibc-ng is not selectable in the C library choice...

I missed this, thanks for pointing it out.

As I describe below, the bug is due to selecting 32 bit userspace when
building for a 64 bit CPU. This patch does not resolve that issue, as
you point out.

>
> So now I am confused. Could you explain why you had to hide away the gcc
> versions when uclibc-ng is selected? And how you even managed to select
> uClibc-ng with powerpc64 to begine with? Can you share a defconfig that
> exhibits the issue?

I was looking at this autobuild failure:

  powerpc    |         uclibc-1.0.40          | NOK |
http://autobuild.buildroot.net/results/d72f51ccaa2911400e5b607e7fd259093e5f4b8a
|

The build error was:

In file included from ./libpthread/nptl/../nptl_db/thread_db.h:28,
                 from ./libpthread/nptl/descr.h:30,
                 from ./libpthread/nptl/pthreadP.h:25,
                 from <stdin>:2:
./include/sys/procfs.h:56:21: error: conflicting types for 'elf_vrregset_t'
   56 | typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG];
      |                     ^~~~~~~~~~~~~~
In file included from
/home/autobuild/autobuild/instance-3/output-1/build/linux-headers-5.15.33/usr/include/asm/sigcontext.h:14,
                 from ./include/bits/sigcontext.h:30,
                 from ./include/signal.h:396,
                 from ./include/sys/procfs.h:26,
                 from ./libpthread/nptl/../nptl_db/thread_db.h:28,
                 from ./libpthread/nptl/descr.h:30,
                 from ./libpthread/nptl/pthreadP.h:25,
                 from <stdin>:2:
/home/autobuild/autobuild/instance-3/output-1/build/linux-headers-5.15.33/usr/include/asm/elf.h:161:21:
note: previous declaration of 'elf_vrregset_t' was here
  161 | typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG];
      |                     ^~~~~~~~~~~~~~

When I looked around for similar failures I found this, which led me
down the path of "why is buildroot building uclibc for the 630?" (the
630 is a 64-bit processor):

https://lore.kernel.org/all/20160711043453.GA28468@waldemar-brodkorb.de/

This is where I got a bit confused, and it becomes obvious I didn't
retest the defconfig that was failing before sending my patch.

From the top of the defconfig, it is not configured for 64 bit (so my
patch wouldn't have helped):

BR2_powerpc=y
BR2_powerpc_630=y

My apologies. Thanks for your careful review.

There's still an autobuilder failure that would be nice to avoid.

It will show up for any 64 bit powerpc machine that is configured in
buildroot with a 32 bit userspace. There's no defconfigs that do this
in the tree, but the autobuilder appears to generate them on occasion.

The gcc build defaults to the target machine, which is 64 bit, so gcc
has the __powerpc64__ preprocessor set. uclibc then errors out as the
kernel headers have unexpected values set.

To fix the issue, buildroot would need to build the toolchain so it
defaulted to 32 bit (by setting GCC_TARGET_CPU to powerpc), or ensure
it passed -mcpu=powerpc to GCC each time it was invoked (for compiling
and for linking).

Alternatively, buildroot could change the arch configuration to not
allow 32 bit userspace to be built if a 64 bit machine has been
selected. If users wanted to run a 32 bit userspace they could still
build userspace for a generic powerpc machine, which achieves a
similar result without having to maintain the mixed configuration.

Cheers,

Joel


>
> Regards,
> Yann E. MORIN.
>
> >       select BR2_TOOLCHAIN_GCC_AT_LEAST_9
> >
> >  config BR2_GCC_VERSION_10_X
> > @@ -43,6 +45,8 @@ config BR2_GCC_VERSION_10_X
> >       # upstream gcc. C-SKY gcc upstream support not tested
> >       # with upstream binutils and glibc.
> >       depends on !BR2_csky
> > +     # 64 bit powerpc is not supported by uclibc
> > +     depends on !(BR2_TOOLCHAIN_USES_UCLIBC && (BR2_powerpc64 || BR2_powerpc64le))
> >       select BR2_TOOLCHAIN_GCC_AT_LEAST_10
> >
> >  config BR2_GCC_VERSION_11_X
> > @@ -54,6 +58,8 @@ config BR2_GCC_VERSION_11_X
> >       # that need to be reverted since gcc 8.4, 9.3 and 10.1.
> >       # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98784
> >       depends on !BR2_sparc
> > +     # 64 bit powerpc is not supported by uclibc
> > +     depends on !(BR2_TOOLCHAIN_USES_UCLIBC && (BR2_powerpc64 || BR2_powerpc64le))
> >       select BR2_TOOLCHAIN_GCC_AT_LEAST_11
> >
> >  endchoice
> > --
> > 2.35.1
> >
> > _______________________________________________
> > buildroot mailing list
> > buildroot@buildroot.org
> > https://lists.buildroot.org/mailman/listinfo/buildroot
>
> --
> .-----------------.--------------------.------------------.--------------------.
> |  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.  |
> '------------------------------^-------^------------------^--------------------'
diff mbox series

Patch

diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
index a1fe192d3a24..3364860ec7a4 100644
--- a/package/gcc/Config.in.host
+++ b/package/gcc/Config.in.host
@@ -31,6 +31,8 @@  config BR2_GCC_VERSION_9_X
 	# upstream gcc. C-SKY gcc upstream support not tested
 	# with upstream binutils and glibc.
 	depends on !BR2_csky
+	# 64 bit powerpc is not supported by uclibc
+	depends on !(BR2_TOOLCHAIN_USES_UCLIBC && (BR2_powerpc64 || BR2_powerpc64le))
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_9
 
 config BR2_GCC_VERSION_10_X
@@ -43,6 +45,8 @@  config BR2_GCC_VERSION_10_X
 	# upstream gcc. C-SKY gcc upstream support not tested
 	# with upstream binutils and glibc.
 	depends on !BR2_csky
+	# 64 bit powerpc is not supported by uclibc
+	depends on !(BR2_TOOLCHAIN_USES_UCLIBC && (BR2_powerpc64 || BR2_powerpc64le))
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_10
 
 config BR2_GCC_VERSION_11_X
@@ -54,6 +58,8 @@  config BR2_GCC_VERSION_11_X
 	# that need to be reverted since gcc 8.4, 9.3 and 10.1.
 	# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98784
 	depends on !BR2_sparc
+	# 64 bit powerpc is not supported by uclibc
+	depends on !(BR2_TOOLCHAIN_USES_UCLIBC && (BR2_powerpc64 || BR2_powerpc64le))
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_11
 
 endchoice