diff --git a/objc/message.h b/objc/message.h index d2f3831..d99ad90 100644 --- a/objc/message.h +++ b/objc/message.h @@ -34,10 +34,20 @@ id objc_msgSend(id self, SEL _cmd, ...); * architecture, so take great care if using this function for small (two * integer) structures. */ -#ifdef __cplusplus +#ifdef __cplusplus id objc_msgSend_stret(id self, SEL _cmd, ...); #else +// There is a bug in older versions of clang that incorrectly declares the +// signature of this function as a builtin. +# ifdef __clang__ +# if (__clang_major__ > 3) || ((__clang_major__ == 3) && __clang_minor__ >= 2) void objc_msgSend_stret(id self, SEL _cmd, ...); +# else +id objc_msgSend_stret(id self, SEL _cmd, ...); +# endif +# else +void objc_msgSend_stret(id self, SEL _cmd, ...); +# endif #endif /** * Standard message sending function. This function must be cast to the diff --git a/objc_msgSend.x86-64.S b/objc_msgSend.x86-64.S index 8ce012b..62d78da 100644 --- a/objc_msgSend.x86-64.S +++ b/objc_msgSend.x86-64.S @@ -95,7 +95,7 @@ push %rsi # Save self where it can be modified mov %rsp, %rdi push %rdx - mov %rdx, %rsi # move _cmd to where the callee expects it to be + mov %rdx, %rsi # move _cmd to where the callee expects it to be .endif .cfi_adjust_cfa_offset 0xD8