Properly detect x32.
authorAdam Borowski <kilobyte@angband.pl>
Sat, 26 Feb 2022 17:21:41 +0000 (17:21 +0000)
committerSebastian Ramacher <sramacher@debian.org>
Sat, 26 Feb 2022 17:21:41 +0000 (17:21 +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 properly_detect_x32.patch

common/common.h
configure

index 9d84e74623e1224c54afa72cf554087a6949f516..9628e949218c8c7334ef5780e8b15a5fa8cff7fb 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 b4426d62e8fe7429f6190da65ee7a2891e9b59e2..824e4772c8f0c4ef97ec899074960deb754c7b13 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