This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, try 2] Fix thiscall trampoline for x86


Peter Rosin skrev 2012-03-21 23:16:
> diff --git a/src/x86/ffi.c b/src/x86/ffi.c
> index 9343c26..ea5a83c 100644
> --- a/src/x86/ffi.c
> +++ b/src/x86/ffi.c
> @@ -593,7 +593,7 @@ ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue,
>  { unsigned char *__tramp = (unsigned char*)(TRAMP); \
>     unsigned int  __fun = (unsigned int)(FUN); \
>     unsigned int  __ctx = (unsigned int)(CTX); \
> -   unsigned int  __dis = __fun - (__ctx + 22);  \
> +   unsigned int  __dis = __fun - (__ctx + 49);  \
>     unsigned short __size = (unsigned short)(SIZE); \
>     *(unsigned int *) &__tramp[0] = 0x8324048b;	/* mov (%esp), %eax */ \
>     *(unsigned int *) &__tramp[4] = 0x4c890cec;	/* sub $12, %esp */ \

Hmmm, look what I found!

http://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=5f78be1e48f53b6cd5f

That hunk is already in the GCC repo, it seems.  So why did I have to
rediscover, debug and fix this too?  Ahhh, the latest merge (feb10)
missed this GCC commit with a couple of days (feb13).

Oh well, at least I learned a thing or two going through that exercise...

Cheers,
Peter


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]