public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
* Re: libffi is broken for x32
       [not found] <CAMe9rOpTqX-d+CoSnxqug__gYv1HVZ8+6-KBqQ8fWo9+sH07Cg@mail.gmail.com>
@ 2015-01-12 23:46 ` H.J. Lu
  2015-01-13  0:29   ` Richard Henderson
  2015-01-13  0:59   ` H.J. Lu
  0 siblings, 2 replies; 7+ messages in thread
From: H.J. Lu @ 2015-01-12 23:46 UTC (permalink / raw)
  To: Anthony Green, GCC Patches, libffi-discuss

[-- Attachment #1: Type: text/plain, Size: 606 bytes --]

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.

[-- Attachment #2: 0001-Set-TARGET-to-X86_64-if-__x86_64__-is-defined.patch --]
[-- Type: text/x-patch, Size: 785 bytes --]

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: libffi is broken for x32
  2015-01-12 23:46 ` libffi is broken for x32 H.J. Lu
@ 2015-01-13  0:29   ` Richard Henderson
  2015-01-13  0:57     ` H.J. Lu
  2015-01-13  0:59   ` H.J. Lu
  1 sibling, 1 reply; 7+ messages in thread
From: Richard Henderson @ 2015-01-13  0:29 UTC (permalink / raw)
  To: H.J. Lu, Anthony Green, GCC Patches, libffi-discuss

On 01/12/2015 03:46 PM, H.J. Lu wrote:
> 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.

I thought the target for that was x86_64-*-linux-gnux32?

There's not usually an x32 multilib for "plain" 64-bit, so
I wonder how you're configuring?


r~

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: libffi is broken for x32
  2015-01-13  0:29   ` Richard Henderson
@ 2015-01-13  0:57     ` H.J. Lu
  2015-01-13  1:13       ` Richard Henderson
  0 siblings, 1 reply; 7+ messages in thread
From: H.J. Lu @ 2015-01-13  0:57 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Anthony Green, GCC Patches, libffi-discuss

On Mon, Jan 12, 2015 at 4:29 PM, Richard Henderson <rth@redhat.com> wrote:
> On 01/12/2015 03:46 PM, H.J. Lu wrote:
>> 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.
>
> I thought the target for that was x86_64-*-linux-gnux32?
>
> There's not usually an x32 multilib for "plain" 64-bit, so
> I wonder how you're configuring?
>

The problem is my x86_64-*-linux-gnux32 patch

https://gcc.gnu.org/ml/gcc-patches/2012-08/msg01083.html

was never accepted upstream.  Can I apply it to config.guess
in GCC?



-- 
H.J.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: libffi is broken for x32
  2015-01-12 23:46 ` libffi is broken for x32 H.J. Lu
  2015-01-13  0:29   ` Richard Henderson
@ 2015-01-13  0:59   ` H.J. Lu
  1 sibling, 0 replies; 7+ messages in thread
From: H.J. Lu @ 2015-01-13  0:59 UTC (permalink / raw)
  To: Anthony Green, GCC Patches, libffi-discuss

On Mon, Jan 12, 2015 at 3:46 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> 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.

It fixed GCC build.

Anthony,  can you apply it to libffi?

Thanks.

-- 
H.J.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: libffi is broken for x32
  2015-01-13  0:57     ` H.J. Lu
@ 2015-01-13  1:13       ` Richard Henderson
  2015-01-13 15:35         ` H.J. Lu
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Henderson @ 2015-01-13  1:13 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Anthony Green, GCC Patches, libffi-discuss

On 01/12/2015 04:57 PM, H.J. Lu wrote:
> The problem is my x86_64-*-linux-gnux32 patch
> 
> https://gcc.gnu.org/ml/gcc-patches/2012-08/msg01083.html
> 
> was never accepted upstream.  Can I apply it to config.guess
> in GCC?

Ah.  Hmm.  Perhaps the configure.host patch would be better after all.


r~

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: libffi is broken for x32
  2015-01-13  1:13       ` Richard Henderson
@ 2015-01-13 15:35         ` H.J. Lu
  2015-01-13 15:51           ` Richard Henderson
  0 siblings, 1 reply; 7+ messages in thread
From: H.J. Lu @ 2015-01-13 15:35 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Anthony Green, GCC Patches, libffi-discuss

On Mon, Jan 12, 2015 at 5:13 PM, Richard Henderson <rth@redhat.com> wrote:
> On 01/12/2015 04:57 PM, H.J. Lu wrote:
>> The problem is my x86_64-*-linux-gnux32 patch
>>
>> https://gcc.gnu.org/ml/gcc-patches/2012-08/msg01083.html
>>
>> was never accepted upstream.  Can I apply it to config.guess
>> in GCC?
>
> Ah.  Hmm.  Perhaps the configure.host patch would be better after all.
>

Can I apply it to GCC trunk?

Thanks.

-- 
H.J.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: libffi is broken for x32
  2015-01-13 15:35         ` H.J. Lu
@ 2015-01-13 15:51           ` Richard Henderson
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Henderson @ 2015-01-13 15:51 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Anthony Green, GCC Patches, libffi-discuss

On 01/13/2015 07:35 AM, H.J. Lu wrote:
> Can I apply it to GCC trunk?

Please.


r~

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-01-13 15:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAMe9rOpTqX-d+CoSnxqug__gYv1HVZ8+6-KBqQ8fWo9+sH07Cg@mail.gmail.com>
2015-01-12 23:46 ` libffi is broken for x32 H.J. Lu
2015-01-13  0:29   ` Richard Henderson
2015-01-13  0:57     ` H.J. Lu
2015-01-13  1:13       ` Richard Henderson
2015-01-13 15:35         ` H.J. Lu
2015-01-13 15:51           ` Richard Henderson
2015-01-13  0:59   ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).