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