Properly detect x32.
authorAdam Borowski <kilobyte@angband.pl>
Tue, 30 Jul 2024 13:09:54 +0000 (15:09 +0200)
committerSebastian Ramacher <sramacher@debian.org>
Tue, 14 Jul 2026 08:03:13 +0000 (10:03 +0200)
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 0001-properly_detect_x32.patch

common/common.h
configure

index a22e22499a0dda55dc39de0d47577fb564482a83..6d935c6116f49300c1969ce289082cbd4a7091da 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 d1d0a471d26a106ba1b1516bfc08604edb742a35..48c22f29a8d1a569d8a28e1692dd3560f9253803 100755 (executable)
--- a/configure
+++ b/configure
@@ -759,6 +759,10 @@ esac
 
 LDFLAGS="$LDFLAGS $libm"
 
+case `$CC -dumpmachine` in
+    *gnux32) host_cpu=x32
+esac
+
 stack_alignment=4
 case $host_cpu in
     i*86)
@@ -815,6 +819,10 @@ case $host_cpu in
             ASFLAGS="$ASFLAGS -f elf64"
         fi
         ;;
+    x32)
+        ARCH="X32"
+        CFLAGS="$CFLAGS -fPIC"
+        ;;
     powerpc*)
         ARCH="PPC"
         if [ $asm = auto ] ; then