Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: "brvs2022@outlook.com" <brvs2022@outlook.com>
Cc: "buildroot@buildroot.org" <buildroot@buildroot.org>,
	Romain Naour <romain.naour@gmail.com>
Subject: Re: [Buildroot] [PATCH] arch/x86: add support for x86_64 x32 ABI
Date: Tue, 30 Dec 2025 14:12:01 +0100	[thread overview]
Message-ID: <20251230141201.33e6e44f@windsurf> (raw)
In-Reply-To: <MA4P292MB00676659A30D80724F77DB70CBA1A@MA4P292MB0067.ESPP292.PROD.OUTLOOK.COM>

Hello Trevor,

Thanks for your patch!

On Thu, 11 Dec 2025 09:58:29 +0000
"brvs2022@outlook.com" <brvs2022@outlook.com> wrote:

> From d9e20f4b358b08de6c01fbb1e7b605e01332e2db Mon Sep 17 00:00:00 2001
> From: Trevor Bastion <brvs2022@outlook.com>
> Date: Thu, 11 Dec 2025 09:46:09 +0000
> Subject: [PATCH] arch/x86: add support for x86_64 x32 ABI

It seems like you didn't use "git send-email", and therefore we have
this header within the e-mail body, which isn't quite good. Could you
use git send-email instead?

> Add support for the x86_64 x32 ABI, which uses the 64-bit x86
> instruction set while keeping 32-bit pointers and size types.

Is this still maintained/support in upstream gcc/glibc? I have vague
memories of discussions about dropping support for x32, but maybe my
memory is wrong.


> +config BR2_x86_x32_ABI
> +	bool "x86_x32_ABI"

You're adding support for it as if it's a separate architecture, which
is not correct. It should be an option inside the x86-64 architecture.


>  config BR2_NORMALIZED_ARCH
> -	default "i386"		if !BR2_x86_64
> -	default "x86_64"	if BR2_x86_64
> +	default "i386"		if !BR2_x86_64 && !BR2_x86_x32_ABI
> +	default "x86_64"	if !BR2_i386 && !BR2_x86_x32_ABI
> +	default "x86_64"	if !BR2_i386 && !BR2_x86_64

This seems odd. Aren't the last two lines better expressed as:

	default "x86_64"	if BR2_x86_64 || BR2_x86_x32_ABI

but of course that will change if BR2_x86_x32_ABI is no longer a
separate architecture.

> +config BR2_GCC_TARGET_ABI
> +	default "mx32"		if BR2_x86_x32_ABI

> +ifeq ($(BR2_x86_x32_ABI),y)
> +ABI = x32
> +TARGET_ABI += -mx32

I don't think assigning TARGET_ABI is needed here, because above,
you're setting BR2_GCC_TARGET_ABI to mx32 already, which has the
following consequence:

1. For internal toolchains: gcc is built with --with-abi=mx32

2. For external toolchains: the toolchain wrapper will pass -mabi=mx32


>  	depends on !BR2_POWERPC_CPU_HAS_SPE
> diff --git a/package/glibc/glibc.mk b/package/glibc/glibc.mk
> index a7727cbad8..a3fec13605 100644
> --- a/package/glibc/glibc.mk
> +++ b/package/glibc/glibc.mk
> @@ -75,6 +75,10 @@ else ifeq ($(BR2_MIPS_OABI32),y)
>  GLIBC_EXTRA_CFLAGS += -mabi=32
>  endif
>  
> +ifeq ($(BR2_x86_x32_ABI),y)
> +GLIBC_EXTRA_CFLAGS += -mx32

I'm also not 100% sure this is needed as gcc will be built with
--with-abi=mx32. Could you test without this?


> diff --git a/package/iptables/Config.in b/package/iptables/Config.in
> index ef02c26242..e5a9b06152 100644
> --- a/package/iptables/Config.in
> +++ b/package/iptables/Config.in
> @@ -1,5 +1,6 @@
>  config BR2_PACKAGE_IPTABLES
>  	bool "iptables"
> +	depends on !BR2_x86_x32_ABI

Is iptables the only problematic package?

Will you help fix x32 build issues in our autobuilders? Indeed, beyond
initial support, there is the on-going maintenance effort and we
clearly don't want to be "alone" to struggle with the x32 issues once
the support has been merged.

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2025-12-30 13:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-11  9:58 [Buildroot] [PATCH] arch/x86: add support for x86_64 x32 ABI brvs2022
2025-12-30 13:12 ` Thomas Petazzoni via buildroot [this message]
2025-12-30 17:21   ` Julien Olivain via buildroot

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=20251230141201.33e6e44f@windsurf \
    --to=buildroot@buildroot.org \
    --cc=brvs2022@outlook.com \
    --cc=romain.naour@gmail.com \
    --cc=thomas.petazzoni@bootlin.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox