Properly detect x32.
authorAdam Borowski <kilobyte@angband.pl>
Sun, 28 Jan 2024 21:48:50 +0000 (22:48 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 28 Jan 2024 21:48:50 +0000 (22:48 +0100)
As usually, x32 gets mistaken for amd64 (both are x86-64 ABIs after all).
This version doesn't use any assembly yet, a proper port is needed.

Gbp-Pq: Name properly_detect_x32.patch

common/common.h
configure

index 975e1d4f6c41905f0bf5a1981a0a7eb7d2d35f1c..ff1d410b793bccb3c1893f4c535e35d4b9f2e3bf 100644 (file)
@@ -804,7 +804,7 @@ static ALWAYS_INLINE int x264_predictor_clip( int16_t (*dst)[2], int16_t (*mvc)[
     return cnt;
 }
 
-#if ARCH_X86 || ARCH_X86_64
+#if ARCH_X86 || ARCH_X86_64 || ARCH_X32
 #include "x86/util.h"
 #endif
 
index e242e73cb926944e659cf56c7076bb6b63739527..de2b7111e2861e593cb16138626d4bd7a1667fd5 100755 (executable)
--- a/configure
+++ b/configure
@@ -736,6 +736,10 @@ esac
 
 LDFLAGS="$LDFLAGS $libm"
 
+case `$CC -dumpmachine` in
+    *gnux32) host_cpu=x32
+esac
+
 stack_alignment=4
 case $host_cpu in
     i*86)
@@ -792,6 +796,10 @@ case $host_cpu in
             ASFLAGS="$ASFLAGS -f elf64"
         fi
         ;;
+    x32)
+        ARCH="X32"
+        CFLAGS="$CFLAGS -fPIC"
+        ;;
     powerpc*)
         ARCH="PPC"
         if [ $asm = auto ] ; then