xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-multimedia/x264/x264/Fix-X32-build-by-disabling-asm.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From 7bc25f4d1aaa5186d2eff3e2326c7245fcd7e7f3 Mon Sep 17 00:00:00 2001
2From: Christopher Larson <chris_larson@mentor.com>
3Date: Tue, 13 Dec 2016 14:22:32 -0700
4Subject: [PATCH] Fix X32 build by disabling asm
5
6This applies gentoo's x32 patch, adjusted slightly, which disables asm support
7for x32 as well as correcting -m.
8
9Debian has a different patch which does the same, and there's a superior yet
10out of date patch series on the x264 list which keeps asm support enabled, but
11doesn't successfully build at this time, and my assembly is very rusty.
12
13Upstream-Status: Pending
14Signed-off-by: Christopher Larson <chris_larson@mentor.com>
15
16---
17 configure | 14 ++++++++++++--
18 1 file changed, 12 insertions(+), 2 deletions(-)
19
20diff --git a/configure b/configure
21index 51b128d..6ea9469 100755
22--- a/configure
23+++ b/configure
24@@ -754,7 +754,13 @@ case $host_cpu in
25         AS_EXT=".asm"
26         ASFLAGS="$ASFLAGS -DARCH_X86_64=1 -I\$(SRCPATH)/common/x86/"
27         stack_alignment=16
28-        [ $compiler = GNU ] && CFLAGS="-m64 $CFLAGS" && LDFLAGS="-m64 $LDFLAGS"
29+        if [ $compiler = GNU ]; then
30+            if cpp_check "" "" "__ILP32__" ; then
31+                CFLAGS="-mx32 $CFLAGS" && LDFLAGS="-mx32 $LDFLAGS"
32+            else
33+                CFLAGS="-m64 $CFLAGS" && LDFLAGS="-m64 $LDFLAGS"
34+            fi
35+        fi
36         if [ "$SYS" = MACOSX ]; then
37             ASFLAGS="$ASFLAGS -f macho64 -DPREFIX"
38             if cc_check '' "-arch x86_64"; then
39@@ -773,7 +779,11 @@ case $host_cpu in
40                 RCFLAGS="--target=pe-x86-64 $RCFLAGS"
41             fi
42         else
43-            ASFLAGS="$ASFLAGS -f elf64"
44+            if cpp_check "" "" "__ILP32__" ; then
45+                asm=no
46+            else
47+                ASFLAGS="$ASFLAGS -f elf64"
48+            fi
49         fi
50         ;;
51     powerpc*)
52