Index: src/runtime/lookup-asm/lookup-asm-x86-elf.S ================================================================== --- src/runtime/lookup-asm/lookup-asm-x86-elf.S +++ src/runtime/lookup-asm/lookup-asm-x86-elf.S @@ -95,14 +95,21 @@ movl 4(%esp), %edx movl (%edx), %eax testl %eax, %eax jz .LreturnNilMethod + subl $16, %esp + movl %eax, (%esp) + movl 24(%esp), %eax movl %eax, 4(%esp) - mov 4(%edx), %edx - mov 32(%edx), %edx - jmp .Lmain_\lookup + + movl 4(%edx), %edx + movl 32(%edx), %edx + call .Lmain_\lookup + + addl $16, %esp + ret .type \name, %function .size \name, .-\name .endm GENERATE_LOOKUP objc_msg_lookup objc_methodNotFound Index: src/runtime/lookup-asm/lookup-asm-x86-win32.S ================================================================== --- src/runtime/lookup-asm/lookup-asm-x86-win32.S +++ src/runtime/lookup-asm/lookup-asm-x86-win32.S @@ -81,17 +81,24 @@ \name: _CET_ENDBR movl 4(%esp), %edx movl (%edx), %eax - test %eax, %eax + testl %eax, %eax jz .LreturnNilMethod + subl $16, %esp + movl %eax, (%esp) + movl 24(%esp), %eax movl %eax, 4(%esp) + movl 4(%edx), %edx movl 32(%edx), %edx - jmp .Lmain_\lookup + call .Lmain_\lookup + + addl $16, %esp + ret .def \name .scl 2 .type 32 .endef .endm