Properly detect x32.
authorAdam Borowski <kilobyte@angband.pl>
Tue, 30 Jul 2024 13:09:54 +0000 (15:09 +0200)
committerPeter Michael Green <plugwash@raspbian.org>
Fri, 6 Feb 2026 03:44:40 +0000 (03:44 +0000)
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 5116bb971e72fc07ad2f05851f5bb23461df2fff..ef51d6ab9f447d4f75ab4e85169d5026d7511648 100755 (executable)
--- a/configure
+++ b/configure
@@ -758,6 +758,10 @@ esac
 
 LDFLAGS="$LDFLAGS $libm"
 
+case `$CC -dumpmachine` in
+    *gnux32) host_cpu=x32
+esac
+
 stack_alignment=4
 case $host_cpu in
     i*86)
@@ -814,6 +818,10 @@ case $host_cpu in
             ASFLAGS="$ASFLAGS -f elf64"
         fi
         ;;
+    x32)
+        ARCH="X32"
+        CFLAGS="$CFLAGS -fPIC"
+        ;;
     powerpc*)
         ARCH="PPC"
         if [ $asm = auto ] ; then