From d8192c3a64f3994b449b6f73784d70a622adef84 Mon Sep 17 00:00:00 2001 From: theraven Date: Fri, 4 May 2012 13:28:08 +0000 Subject: [PATCH] Always return 64-bit 0 in response to a message to nil on x86. --- objc_msgSend.x86-32.S | 4 +++- sendmsg2.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/objc_msgSend.x86-32.S b/objc_msgSend.x86-32.S index dc1421b..f55f8c3 100644 --- a/objc_msgSend.x86-32.S +++ b/objc_msgSend.x86-32.S @@ -57,9 +57,11 @@ jmp *%eax 4: # returnNil: .if \fpret - fldz + fldz .else xor %eax, %eax # return 0 (int) + xor %edx, %edx # Return 64-bit zero (%edx is + # caller-save, so it's safe to do this in the general case. .endif ret 5: # slowSend: diff --git a/sendmsg2.c b/sendmsg2.c index a00aba8..b017e9e 100644 --- a/sendmsg2.c +++ b/sendmsg2.c @@ -9,7 +9,7 @@ void objc_send_initialize(id object); -static id nil_method(id self, SEL _cmd) { return nil; } +static long long nil_method(id self, SEL _cmd) { return 0; } static struct objc_slot nil_slot = { Nil, Nil, 0, 1, (IMP)nil_method };