On Sun, Oct 26, 2025 at 2:26 AM Alexandre Oliva <[email protected]> wrote:
>
>
> Enable a 32-bit "native" toolchain to be built on x86_64-linux-gnu,
> i.e., one that targets -m32 despite running in 64-bit mode. Neither
> multilibs nor -m64 support are desired for this configuration (a
> multilibbed x86_64-linux-gnu native, defaulting to -m32 through self
> specs would accomplish those).
>
> Tested with x86_64-linux-gnu native. Ok to install?
>
> From: Olivier Hainque <[email protected]>
>
> for gcc/ChangeLog
>
> * config.gcc [x86_64-*-*]: Match *m32 target, default to m32
> abi and multilib. Accept 32 or m32 for --with-abi.
Shouldn't this target be named x86_64-linux-gnu32?
Canonical system name infers ABI like:
arm-unknown-linux-gnueabihf
x86_64-pc-linux-gnux32
so IMO we should follow the above examples with:
x86_64-linux-gnu32 (so, without "m").
Precedent for this kind of extension is gnux32, GNU x32 ABI (ILP32 ABI
on x86_64).
> ---
> gcc/config.gcc | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/gcc/config.gcc b/gcc/config.gcc
> index c678b801f705c..8d96ef00005ad 100644
> --- a/gcc/config.gcc
> +++ b/gcc/config.gcc
> @@ -676,6 +676,29 @@ i[34567]86-*-*)
> x86_64-*-darwin*)
> ;;
> x86_64-*-*)
> + # Pick a default with_abi and with_multilib_list for m32
> + # restricted toolchains
> + case ${target} in
> + *m32)
"*gnu32)" if we go with the above adjustment.
> + case ${with_abi} in
> + "" | 32 | m32)
> + with_abi=m32
> + ;;
> + *)
> + echo "Invalid --with-abi=$with_abi for m32 target"
... for gnu32 target
> + exit 1
> + esac
> + case ${with_multilib_list} in
> + default | m32)
> + with_multilib_list=m32
> + ;;
> + *)
> + echo "Invalid multilib list for m32 target"
... for gnu32 target
> + exit 1
> + esac
> + ;;
> + esac
> +
> case ${with_abi} in
> "")
> if test "x$with_multilib_list" = xmx32; then
> @@ -690,6 +713,8 @@ x86_64-*-*)
> x32 | mx32)
> tm_file="i386/biarchx32.h ${tm_file}"
> ;;
> + 32 | m32)
> + ;;
> *)
> echo "Unknown ABI used in --with-abi=$with_abi"
> exit 1
Uros.