Properly detect x32.
authorAdam Borowski <kilobyte@angband.pl>
Sun, 12 Jul 2020 16:46:44 +0000 (17:46 +0100)
committerSebastian Ramacher <sramacher@debian.org>
Sun, 12 Jul 2020 16:46:44 +0000 (17:46 +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 0a8ae95ec232d8ad2800cd6a66e4540673085a59..c3cf0b8d68c85cb78f6b15b3be253521ee200c12 100644 (file)
@@ -800,7 +800,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 56a8b7bac0e40786ab95eb07776c0d6b0578f27f..377d413025cdd7237351b8331502f5bd89e8d309 100755 (executable)
--- a/configure
+++ b/configure
@@ -720,6 +720,10 @@ esac
 
 LDFLAGS="$LDFLAGS $libm"
 
+case `$CC -dumpmachine` in
+    *gnux32) host_cpu=x32
+esac
+
 stack_alignment=4
 case $host_cpu in
     i*86)
@@ -776,6 +780,10 @@ case $host_cpu in
             ASFLAGS="$ASFLAGS -f elf64"
         fi
         ;;
+    x32)
+        ARCH="X32"
+        CFLAGS="$CFLAGS -fPIC"
+        ;;
     powerpc*)
         ARCH="PPC"
         if [ $asm = auto ] ; then