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.
---
 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)
+               case ${with_abi} in
+               "" | 32 | m32)
+                       with_abi=m32
+                       ;;
+               *)
+                       echo "Invalid --with-abi=$with_abi for m32 target"
+                       exit 1
+              esac
+              case ${with_multilib_list} in
+              default | m32)
+                       with_multilib_list=m32
+                       ;;
+              *)
+                       echo "Invalid multilib list for m32 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


-- 
Alexandre Oliva, happy hacker            https://blog.lx.oliva.nom.br/
Free Software Activist     FSFLA co-founder     GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity.
Excluding neuro-others for not behaving ""normal"" is *not* inclusive!

Reply via email to