diff --git a/common.S b/common.S index a8cc09a..4fab30c 100644 --- a/common.S +++ b/common.S @@ -1,4 +1,4 @@ -#if defined(__WIN32__) || defined(__APPLE__) +#if (defined(_WIN32) && defined(__i386__)) || defined(__APPLE__) #define CDECL(symbol) _##symbol #else #define CDECL(symbol) symbol diff --git a/objc_msgSend.x86-32.S b/objc_msgSend.x86-32.S index 77193bd..7d83a4c 100644 --- a/objc_msgSend.x86-32.S +++ b/objc_msgSend.x86-32.S @@ -54,7 +54,7 @@ push %ecx # _cmd push %eax # &self .cfi_def_cfa_offset 12 - call slowMsgLookup@PLT + call CDECL(slowMsgLookup)@PLT add $8, %esp # restore the stack @@ -65,8 +65,14 @@ 7: popl %ebx; 8: +#if __ELF__ + # ELF can support GOT-relative addressing; + # PE/COFF and Mach-O need a text relocation. addl $_GLOBAL_OFFSET_TABLE_+(8b-7b), %ebx leal SmallObjectClasses@GOTOFF(%ebx), %eax +#else + leal CDECL(SmallObjectClasses), %eax +#endif mov (%eax), %eax popl %ebx jmp 1b