Properly detect x32.
authorAdam Borowski <kilobyte@angband.pl>
Sun, 26 Jul 2020 14:52:56 +0000 (15:52 +0100)
committerSebastian Ramacher <sramacher@debian.org>
Sun, 26 Jul 2020 14:52:56 +0000 (15:52 +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 8bc5c26ddcb8a97aa82183e9998a58064e231c4a..50fd8ea3becd79fa28077901aee0625fddbd8f9f 100644 (file)
@@ -802,7 +802,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 3a5e0602b77e8a1639e1cf2d6faf92236a2f4b83..ec0932c75f6d6acb095d5f59ebee2b096e0338b3 100755 (executable)
--- a/configure
+++ b/configure
@@ -721,6 +721,10 @@ esac
 
 LDFLAGS="$LDFLAGS $libm"
 
+case `$CC -dumpmachine` in
+    *gnux32) host_cpu=x32
+esac
+
 stack_alignment=4
 case $host_cpu in
     i*86)
@@ -777,6 +781,10 @@ case $host_cpu in
             ASFLAGS="$ASFLAGS -f elf64"
         fi
         ;;
+    x32)
+        ARCH="X32"
+        CFLAGS="$CFLAGS -fPIC"
+        ;;
     powerpc*)
         ARCH="PPC"
         if [ $asm = auto ] ; then