This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: libffi is broken for x32
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Anthony Green <green at moxielogic dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, libffi-discuss at sourceware dot org
- Date: Mon, 12 Jan 2015 15:46:28 -0800
- Subject: Re: libffi is broken for x32
- Authentication-results: sourceware.org; auth=none
- References: <CAMe9rOpTqX-d+CoSnxqug__gYv1HVZ8+6-KBqQ8fWo9+sH07Cg at mail dot gmail dot com>
On Mon, Jan 12, 2015 at 2:42 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> This libffi commit:
>
> 13e2d7b92557a9511a0414df82bf2df3edc55cba is the first bad commit
> commit 13e2d7b92557a9511a0414df82bf2df3edc55cba
> Author: Anthony Green <green@moxielogic.com>
> Date: Thu Jan 10 10:52:02 2013 -0500
>
> Handle both 32 and 64-bit x86 builds regardless of target triple
>
> breaks x32.
>
This patch passed "make check" in libffi on x32. I am testing
it in GCC now.
GCC is configured as x86_64-unknown-linux-gnu with x32
enabled. libffi should set TARGET to X86_64 if __x86_64__
is defined.
--
H.J.
From 9aedae5848333acf55fa34fd734d5704364ccaa1 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Mon, 12 Jan 2015 15:25:10 -0800
Subject: [PATCH] Set TARGET to X86_64 if __x86_64__ is defined
---
configure.host | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/configure.host b/configure.host
index 5ee632c..c7eb9c8 100644
--- a/configure.host
+++ b/configure.host
@@ -100,7 +100,13 @@ case "${host}" in
TARGET=X86_64
;;
*)
- TARGET=X86
+ echo 'int foo (void) { return __x86_64__; }' > conftest.c
+ if $CC $CFLAGS -Werror -S conftest.c -o conftest.s > /dev/null 2>&1; then
+ TARGET=X86_64;
+ else
+ TARGET=X86;
+ fi
+ rm -f conftest.*
;;
esac
else
--
1.9.3