public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Haley <aph@redhat.com>
To: Dave Korn <dave.korn.cygwin@googlemail.com>
Cc: libffi-discuss@sourceware.org
Subject: Re: libffi merge
Date: Thu, 04 Jun 2009 16:36:00 -0000	[thread overview]
Message-ID: <4A27F7E5.7060802@redhat.com> (raw)
In-Reply-To: <4A27F4BB.2070902@gmail.com>

Dave Korn wrote:
> Andrew Haley wrote:
>> x86 changes: merge from libffi -> gcc.
>>
>> Timothy Wall, please check this one.
> 
>   I am not he, but ...
> 
>> --- /home/aph/gcc/trunk/libffi/src/x86/win32.S	2009-06-04 15:43:59.000000000 +0100
>> +++ ./src/x86/win32.S	2009-06-04 15:30:26.000000000 +0100
>> @@ -264,6 +264,22 @@
>>  .ffi_call_STDCALL_end:
>>  .LFE2:
>>
>> +	.globl _ffi_closure_STDCALL
>> +_ffi_closure_STDCALL:
>> +	pushl	%ebp
>> +	movl	%esp, %ebp
>> +	subl	$40, %esp
>> +	leal	-24(%ebp), %edx
>> +	movl	%edx, -12(%ebp)	/* resp */
>> +	leal	12(%ebp), %edx  /* account for stub return address on stack */
>> +	movl	%edx, 4(%esp)	/* args */
>> +	leal	-12(%ebp), %edx
>> +	movl	%edx, (%esp)	/* &resp */
>> +	call	_ffi_closure_SYSV_inner
>> +	movl	-12(%ebp), %ecx
>> +	jmp     .Lcls_return_result
>         ^^^^^^^^^^^^^^^^^^^^^^^^^
> 
>   I figured we couldn't share this code, owing to the need to have
> discontiguous FDEs in the debug info.  Looks like you effectively have the
> inverse of my last patch in there along with some of the libffi changes.

Is this the patch you're talking about?

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 147801)
+++ ChangeLog	(revision 147802)
@@ -1,5 +1,10 @@
 2009-05-22  Dave Korn  <dave.korn.cygwin@gmail.com>

+	* src/x86/win32.S (_ffi_closure_STDCALL):  New function.
+	(.eh_frame):  Add FDE for it.
+
+2009-05-22  Dave Korn  <dave.korn.cygwin@gmail.com>
+
 	* configure.ac:  Also check if assembler supports pc-relative
 	relocs on X86_WIN32 targets.
 	* configure:  Regenerate.
Index: src/x86/win32.S
===================================================================
--- src/x86/win32.S	(revision 147801)
+++ src/x86/win32.S	(revision 147802)
@@ -390,6 +390,70 @@

 #endif /* !FFI_NO_RAW_API */

+        # This assumes we are using gas.
+	.balign	16
+	.globl	_ffi_closure_STDCALL
+	.def	_ffi_closure_STDCALL;	.scl	2;	.type	32;	.endef
+_ffi_closure_STDCALL:
+.LFB5:
+	pushl	%ebp
+.LCFI9:
+	movl	%esp, %ebp
+.LCFI10:
+	subl	$40, %esp
+	leal	-24(%ebp), %edx
+	movl	%edx, -12(%ebp)	/* resp */
+	leal	12(%ebp), %edx  /* account for stub return address on stack */
+	movl	%edx, 4(%esp)	/* args */
+	leal	-12(%ebp), %edx
+	movl	%edx, (%esp)	/* &resp */
+	call	_ffi_closure_SYSV_inner
+	movl	-12(%ebp), %ecx
+	/* It would be nice to just share this code with the
+	   duplicate sequence in _ffi_closure_SYSV, if only
+	   there were some way to represent that in the EH info.  */
+	cmpl	$FFI_TYPE_INT, %eax
+	je	.Lscls_retint
+	cmpl	$FFI_TYPE_FLOAT, %eax
+	je	.Lscls_retfloat
+	cmpl	$FFI_TYPE_DOUBLE, %eax
+	je	.Lscls_retdouble
+	cmpl	$FFI_TYPE_LONGDOUBLE, %eax
+	je	.Lscls_retldouble
+	cmpl	$FFI_TYPE_SINT64, %eax
+	je	.Lscls_retllong
+	cmpl	$FFI_TYPE_SINT8, %eax	/* 1-byte struct */
+	je	.Lscls_retstruct1
+	cmpl	$FFI_TYPE_SINT16, %eax	/* 2-bytes struct */
+	je	.Lscls_retstruct2
+.Lscls_epilogue:
+	movl	%ebp, %esp
+	popl	%ebp
+	ret
+.Lscls_retint:
+	movl	(%ecx), %eax
+	jmp	.Lscls_epilogue
+.Lscls_retfloat:
+	flds	(%ecx)
+	jmp	.Lscls_epilogue
+.Lscls_retdouble:
+	fldl	(%ecx)
+	jmp	.Lscls_epilogue
+.Lscls_retldouble:
+	fldt	(%ecx)
+	jmp	.Lscls_epilogue
+.Lscls_retllong:
+	movl	(%ecx), %eax
+	movl	4(%ecx), %edx
+	jmp	.Lscls_epilogue
+.Lscls_retstruct1:
+	movsbl	(%ecx), %eax
+	jmp	.Lscls_epilogue
+.Lscls_retstruct2:
+	movswl	(%ecx), %eax
+	jmp	.Lscls_epilogue
+.ffi_closure_STDCALL_end:
+.LFE5:

 	.section	.eh_frame,"w"
 .Lframe1:
@@ -552,3 +616,34 @@
 .LEFDE4:

 #endif /* !FFI_NO_RAW_API */
+
+.LSFDE5:
+	.long	.LEFDE5-.LASFDE5	/* FDE Length */
+.LASFDE5:
+	.long	.LASFDE5-.Lframe1	/* FDE CIE offset */
+#if defined __PIC__ && defined HAVE_AS_X86_PCREL
+	.long	.LFB5-.	/* FDE initial location */
+#else
+	.long	.LFB5
+#endif
+	.long	.LFE5-.LFB5	/* FDE address range */
+#ifdef __PIC__
+	.byte	0x0	/* .uleb128 0x0; Augmentation size */
+#endif
+	/* DW_CFA_xxx CFI instructions go here.  */
+
+	.byte	0x4	/* DW_CFA_advance_loc4 */
+	.long	.LCFI9-.LFB5
+	.byte	0xe	/* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */
+	.byte	0x8	/* .uleb128 0x8 */
+	.byte	0x85	/* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */
+	.byte	0x2	/* .uleb128 0x2 */
+
+	.byte	0x4	/* DW_CFA_advance_loc4 */
+	.long	.LCFI10-.LCFI9
+	.byte	0xd	/* DW_CFA_def_cfa_register CFA = r5 = %ebp */
+	.byte	0x5	/* .uleb128 0x5 */
+
+	/* End of DW_CFA_xxx CFI instructions.  */
+	.align 4
+.LEFDE5:

  parent reply	other threads:[~2009-06-04 16:36 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-02 17:10 Andrew Haley
2009-06-03 11:03 ` Andrew Haley
2009-06-03 11:54   ` Anthony Green
2009-06-03 19:53     ` Andrew Haley
2009-06-03 20:26       ` Anthony Green
2009-06-04 10:35         ` Andrew Haley
2009-06-04 10:42           ` Andrew Haley
2009-06-04 10:57             ` Andrew Haley
2009-06-04 12:39               ` Anthony Green
2009-06-04 12:49                 ` Andrew Haley
2009-06-04 14:09                   ` Dave Korn
2009-06-04 14:43                     ` Andrew Haley
2009-06-04 15:07                     ` Andrew Haley
2009-06-04 15:41                       ` Andrew Haley
2009-06-04 16:04                         ` Andrew Haley
2009-06-04 16:11                           ` Dave Korn
2009-06-04 16:27                             ` Andrew Haley
2009-06-04 16:36                             ` Andrew Haley [this message]
2009-06-04 17:04                             ` Andrew Haley
2009-06-04 17:46                               ` Timothy Wall
2009-06-04 17:26                                 ` Andrew Haley
2009-06-05 12:12                               ` Dave Korn
2009-06-05 12:53                                 ` Andrew Haley
2009-06-05 13:03                                   ` Andrew Haley
2009-06-05 13:40                                     ` Andrew Haley
2009-06-05 17:24                                       ` Andreas Tobler
2009-06-05 17:37                                         ` Andrew Haley
2009-06-06  2:58                                           ` NightStrike
2009-06-06  8:22                                             ` Andrew Haley
2009-06-07  6:44                                               ` Ralf Wildenhues
2009-06-08 16:22                                                 ` Tom Tromey
2009-06-08 16:35                                                   ` Andrew Haley
2009-06-08 16:54                                                     ` NightStrike
2009-06-08 17:01                                                       ` Andrew Haley
2009-06-08 17:58                                                         ` NightStrike
2009-06-08 18:57                                                           ` Timothy Wall
2009-06-08 22:21                                                           ` Timothy Wall
2009-06-09 15:32                                                             ` Andrew Haley
2009-06-09 16:36                                                               ` Timothy Wall
2009-06-09 16:44                                                                 ` Andrew Haley
2009-06-09 18:08                                                                   ` PATCH libffi testsuite closure fixes Timothy Wall
2009-06-09 18:08                                                               ` PATCH libffi win64 support Timothy Wall
2009-06-10  9:45                                                                 ` Andrew Haley
2009-06-10 10:54                                                                   ` Timothy Wall
2009-06-12 14:21                                                                     ` Andrew Haley
2009-06-12 15:02                                                                       ` Timothy Wall
2009-06-12 15:08                                                                         ` Kai Tietz
2009-06-12 15:17                                                                         ` Andrew Haley
2009-06-12 15:23                                                                       ` Timothy Wall
2009-06-12 15:44                                                                         ` Andrew Haley
2009-06-12 15:46                                                                           ` NightStrike
2009-06-12 15:53                                                                             ` Andrew Haley
2009-06-12 19:17                                                                               ` Timothy Wall
2009-06-12 20:03                                                                                 ` Andrew Haley
2009-06-12 20:31                                                                                   ` Timothy Wall
2009-06-16 15:57                                                                           ` NightStrike
2009-06-16 16:03                                                                             ` NightStrike
2009-06-16 16:26                                                                               ` Andrew Haley
2009-06-16 17:58                                                                                 ` Ralf Wildenhues
2009-06-16 18:20                                                                                   ` Andrew Haley
2009-06-16 19:11                                                                                     ` Ralf Wildenhues
2009-06-17 12:36                                                                                       ` Dave Korn
2009-06-17 12:53                                                                                         ` Andrew Haley
2009-06-17 14:21                                                                                           ` Dave Korn
2009-06-17 17:51                                                                                         ` autom4te caching (was: PATCH libffi win64 support) Ralf Wildenhues
2009-06-16 16:31                                                                             ` PATCH libffi win64 support Andrew Haley
2009-06-16 17:19                                                                               ` NightStrike
2009-06-16 17:37                                                                                 ` Andrew Haley
2009-06-16 17:38                                                                                   ` NightStrike
2009-06-16 17:42                                                                                     ` NightStrike
2009-06-16 17:57                                                                                 ` Ralf Wildenhues
2009-06-17  2:24                                                                                   ` NightStrike
2009-06-08 16:48                                                   ` libffi merge NightStrike
2009-06-08 16:50                                                     ` NightStrike
2009-06-08 18:25                                                   ` Ralf Wildenhues
2009-06-08 18:33                                                     ` Andrew Haley
2009-06-08 17:03                                       ` Andrew Haley
2009-06-09 10:34                                         ` H.J. Lu
2009-06-09 10:39                                           ` Andrew Haley
2009-06-08 17:16                                       ` Andrew Haley
2009-06-09 10:16                                       ` Andrew Haley
2009-06-09 11:45                                         ` Joseph S. Myers
2009-06-09 12:14                                           ` Andrew Haley
2009-06-09 14:58                                             ` Andrew Haley
2009-06-09 17:41                                           ` Ralf Wildenhues
2009-06-09 15:24                                         ` Andrew Haley
2009-06-05 13:11                                   ` Dave Korn
2009-06-04 16:29                           ` Andrew Haley
2009-06-04 17:47                           ` Timothy Wall
2009-06-04 17:53                             ` Andrew Haley
2009-06-05 12:14                               ` Dave Korn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A27F7E5.7060802@redhat.com \
    --to=aph@redhat.com \
    --cc=dave.korn.cygwin@googlemail.com \
    --cc=libffi-discuss@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).