diff mbox series

[v2,3/8] toolchain/gcc: use ELFv2 ABI on ppc64 with musl

Message ID 20211220190104.1964098-4-stijn@linux-ipv6.be
State Accepted, archived
Delegated to: Stijn Tintel
Headers show
Series qoriq: new target | expand

Commit Message

Stijn Tintel Dec. 20, 2021, 7 p.m. UTC
At configuration time, gcc assumes that ppc64be targets use the ELFv1
ABI, and ppc64le targets use the ELFv2 ABI. However, musl libc does not
support the ELFv1 ABI on ppc64 at all, regardless of the endianness.

Therefore, when building for a ppc64 arch and with musl libc, instruct
gcc to use the ELFv2 ABI.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93157 for more info.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
---
 toolchain/gcc/common.mk | 1 +
 1 file changed, 1 insertion(+)

Comments

Rui Salvaterra Dec. 21, 2021, 3:04 p.m. UTC | #1
Hi, Stijn,

On Mon, 20 Dec 2021 at 19:01, Stijn Tintel <stijn@linux-ipv6.be> wrote:
>
> At configuration time, gcc assumes that ppc64be targets use the ELFv1
> ABI, and ppc64le targets use the ELFv2 ABI. However, musl libc does not
> support the ELFv1 ABI on ppc64 at all, regardless of the endianness.
>
> Therefore, when building for a ppc64 arch and with musl libc, instruct
> gcc to use the ELFv2 ABI.
>
> See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93157 for more info.
>
> Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
> ---
>  toolchain/gcc/common.mk | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk
> index a195002888..bef4fa37f8 100644
> --- a/toolchain/gcc/common.mk
> +++ b/toolchain/gcc/common.mk
> @@ -108,6 +108,7 @@ GCC_CONFIGURE:= \
>                 $(if $(CONFIG_mips64)$(CONFIG_mips64el),--with-arch=mips64 \
>                         --with-abi=$(call qstrip,$(CONFIG_MIPS64_ABI))) \
>                 $(if $(CONFIG_arc),--with-cpu=$(CONFIG_CPU_TYPE)) \
> +               $(if $(CONFIG_powerpc64), $(if $(CONFIG_USE_MUSL),--with-abi=elfv2)) \
>                 --with-gmp=$(TOPDIR)/staging_dir/host \
>                 --with-mpfr=$(TOPDIR)/staging_dir/host \
>                 --with-mpc=$(TOPDIR)/staging_dir/host \
> --
> 2.32.0
>

Yes, please. I could be wrong, but I think all ppc64 targets in the
kernel are migrating to the ELFv2 ABI.

Reviewed-by: Rui Salvaterra <rsalvaterra@gmail.com>

Cheers,
Rui
diff mbox series

Patch

diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk
index a195002888..bef4fa37f8 100644
--- a/toolchain/gcc/common.mk
+++ b/toolchain/gcc/common.mk
@@ -108,6 +108,7 @@  GCC_CONFIGURE:= \
 		$(if $(CONFIG_mips64)$(CONFIG_mips64el),--with-arch=mips64 \
 			--with-abi=$(call qstrip,$(CONFIG_MIPS64_ABI))) \
 		$(if $(CONFIG_arc),--with-cpu=$(CONFIG_CPU_TYPE)) \
+		$(if $(CONFIG_powerpc64), $(if $(CONFIG_USE_MUSL),--with-abi=elfv2)) \
 		--with-gmp=$(TOPDIR)/staging_dir/host \
 		--with-mpfr=$(TOPDIR)/staging_dir/host \
 		--with-mpc=$(TOPDIR)/staging_dir/host \