[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] config.guess (x86_64:Linux:*:*): Detect x32 ABI

From: Jessica Clarke
Subject: [PATCH] config.guess (x86_64:Linux:*:*): Detect x32 ABI
Date: Sun, 14 Jun 2020 20:05:25 +0100

This is currently only supported when CC_FOR_BUILD is available, as that
ultimately governs what the native ABI is. Ideally we would always have
a compiler present, and there's very little use for config.guess without
one, but this at least avoids breaking existing setups. A fallback using

    objdump -f `command -v uname` | grep -q elf32-x86-64

could be used even in the absence of a compiler, though a perfectly
valid environment could still have that as an amd64 binary, if unlikely.
We shouldn't check /bin/sh, however, as klibc builds that as an amd64
binary even for x32 (see [0]).

 config.guess | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/config.guess b/config.guess
index 11fda52..92bfc33 100755
--- a/config.guess
+++ b/config.guess
@@ -1095,7 +1095,17 @@ EOF
        echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
        exit ;;
-       echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
+       set_cc_for_build
+       if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
+           if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
+               (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+               grep IS_X32 >/dev/null
+           then
+               LIBCABI="$LIBC"x32
+           fi
+       fi
+       echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI"
        exit ;;
        echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"

reply via email to

[Prev in Thread] Current Thread [Next in Thread]