http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51500
--- Comment #11 from gee <jojelino at gmail dot com> 2012-01-30 15:10:48 UTC --- Comment on attachment 26513 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26513 proposed patch for handling thiscall r3 @@ -505,6 +508,23 @@ ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, ... ... + *(unsigned int*) &__tramp[24] = 0x8304244c; /* xchgl 4(%esp),%ecx*/ \ + *(unsigned short*) &__tramp[28] = 0x04c4; /* add $0x4,%esp */ \ + *(unsigned char*)/* __not short*__ */ &__tramp[30] = 0xc3; /* ret */ \ + } #define FFI_INIT_TRAMPOLINE_STDCALL(TRAMP,FUN,CTX,SIZE) \ { unsigned char *__tramp = (unsigned char*)(TRAMP); \