Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -97,17 +97,17 @@ # define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR # define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR_STRET # endif #else # ifdef __ELF__ -# if defined(__amd64__) || defined(__x86_64__) +# if defined(__amd64__) || defined(__x86_64__) || defined(__i386__) # define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR # if __has_feature(objc_msg_lookup_stret) # define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR_STRET # endif # endif -# if defined(__i386__) || defined(__arm__) || defined(__ARM__) +# if defined(__arm__) || defined(__ARM__) # define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR # endif # if (defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32) || \ (defined(__mips_eabi) && _MIPS_SZPTR == 32) # define OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR Index: src/apple-forwarding-i386.S ================================================================== --- src/apple-forwarding-i386.S +++ src/apple-forwarding-i386.S @@ -36,11 +36,10 @@ pushl %ebx subl $20, %esp call get_eip .L0: - movl 8(%ebp), %eax movl %eax, (%esp) call _object_getClass movl %eax, (%esp) @@ -86,11 +85,10 @@ pushl %ebx subl $20, %esp call get_eip .L1: - movl 12(%ebp), %eax movl %eax, (%esp) call _object_getClass movl %eax, (%esp) Index: src/forwarding-x86-elf.S ================================================================== --- src/forwarding-x86-elf.S +++ src/forwarding-x86-elf.S @@ -17,11 +17,10 @@ .globl of_forward .globl of_forward_stret .section .text of_forward: -of_forward_stret: /* FIXME */ pushl %ebp movl %esp, %ebp pushl %ebx subl $20, %esp @@ -53,35 +52,74 @@ addl $20, %esp popl %ebx popl %ebp jmp *%eax - -get_eip: - movl (%esp), %ebx - ret .type of_forward, %function .size of_forward, .-of_forward +of_forward_stret: + pushl %ebp + movl %esp, %ebp + + pushl %ebx + subl $20, %esp + + call get_eip +.L1: + movl 12(%ebp), %eax + movl %eax, (%esp) + leal sel_forwardingTargetForSelector_-.L1(%ebx), %eax + movl %eax, 4(%esp) + leal objc_msg_lookup-.L1(%ebx), %eax + call *%eax + + movl 12(%ebp), %edx + movl %edx, (%esp) + leal sel_forwardingTargetForSelector_-.L1(%ebx), %edx + movl %edx, 4(%esp) + movl 16(%ebp), %edx + movl %edx, 8(%esp) + call *%eax + + movl %eax, 12(%ebp) + movl %eax, (%esp) + movl 16(%ebp), %eax + movl %eax, 4(%esp) + leal objc_msg_lookup-.L1(%ebx), %eax + call *%eax + + addl $20, %esp + popl %ebx + popl %ebp + + jmp *%eax +.type of_forward_stret, %function +.size of_forward_stret, .-of_forward_stret + init: pushl %ebp movl %esp, %ebp pushl %ebx subl $4, %esp call get_eip -.L1: - leal module-.L1(%ebx), %eax +.L2: + leal module-.L2(%ebx), %eax movl %eax, (%esp) - leal __objc_exec_class-.L1(%ebx), %eax + leal __objc_exec_class-.L2(%ebx), %eax call *%eax addl $4, %esp popl %ebx popl %ebp ret + +get_eip: + movl (%esp), %ebx + ret .section .ctors, "a", %progbits .long init .section .rodata