this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

msgSendSuper/fpret fixes

+68 -5
+6
src/libobjcdarwin/new/class.cpp
··· 84 84 Class c = RegisterClass(cls, slide); 85 85 86 86 if (class_refs) 87 + { 87 88 find_and_fix(class_refs, class_refs_end, cls, c); 89 + find_and_fix(class_refs, class_refs_end, cls->isa, object_getClass(id(c))); 90 + } 88 91 if (super_refs) 92 + { 89 93 find_and_fix(super_refs, super_refs_end, cls, c); 94 + find_and_fix(super_refs, super_refs_end, cls->isa, object_getClass(id(c))); 95 + } 90 96 } 91 97 92 98 }
+3 -3
src/libobjcdarwin/objc_msgSendSuper.nasm
··· 108 108 mov eax, [esp-4] ; restore the IMP 109 109 %endmacro 110 110 111 - __darwin_objc_msgSendSuper2: 111 + __darwin_objc_msgSendSuper: 112 112 mov eax, [esp+4] ; get objc_super* 113 113 ; make a copy on the stack 114 114 mov ecx, [eax] ; 1st elem ··· 120 120 sub esp, 8 121 121 mov eax, [esp+16]; SEL (2nd argument) 122 122 push eax 123 - lea eax, [esp+12]; fixed objc_super (1st argument) 123 + lea eax, [esp+4]; fixed objc_super (1st argument) 124 124 push eax 125 125 126 126 call objc_msg_lookup_super ··· 131 131 132 132 jmp eax 133 133 134 - __darwin_objc_msgSendSuper: 134 + __darwin_objc_msgSendSuper_xxx: 135 135 136 136 mov eax, [esp+8] 137 137 push eax
+13 -1
src/libobjcdarwin/objc_msgSend_fixup.nasm
··· 1 1 global __darwin_objc_msgSend_fixup 2 2 global objc_msgSendSuper2_fixup 3 + global objc_msgSendSuper2_stret_fixup 4 + global __darwin_objc_msgSend_fpret_fixup 5 + global __darwin_objc_msgSend_fp2ret_fixup 3 6 extern objc_msgSend 7 + extern objc_msgSend_fpret 4 8 extern __darwin_objc_msgSendSuper2 9 + extern __darwin_objc_msgSendSuper2_stret 5 10 6 11 section .note.GNU-stack noalloc noexec nowrite progbits 7 12 ··· 10 15 BITS 64 11 16 section text 12 17 13 - ; TODO: msgSendSuper2_fixup... 18 + __darwin_objc_msgSend_fp2ret_fixup: 19 + __darwin_objc_msgSend_fpret_fixup: 20 + mov rsi, [rsi+8] 21 + jmp objc_msgSend_fpret WRT ..plt 14 22 15 23 __darwin_objc_msgSend_fixup: 16 24 mov rsi, [rsi+8] ··· 19 27 objc_msgSendSuper2_fixup: 20 28 mov rsi, [rsi+8] 21 29 jmp __darwin_objc_msgSendSuper2 WRT ..plt 30 + 31 + objc_msgSendSuper2_stret_fixup: 32 + mov rdx, [rdx+8] 33 + jmp __darwin_objc_msgSendSuper2_stret WRT ..plt 22 34 23 35 %elifidn __OUTPUT_FORMAT__, elf 24 36
+1 -1
src/libobjcdarwin/old/class.cpp
··· 134 134 for (uint16_t i = 0; i < info->symtab->countClasses; i++) 135 135 { 136 136 old_class* cls = static_cast<old_class*>(info->symtab->classesAndCategories[i])->isa.cls; 137 - Class c = (Class) objc_getClass(cls->name); 137 + Class c = (Class) objc_getMetaClass(cls->name); 138 138 LOG << "ObjC fixup super_class @" << cls << ": " << cls->name << " -> " << c << std::endl; 139 139 cls->super_class.clsNew = c; 140 140 }
+42
tests/src/objc_fpret.m
··· 1 + // CFLAGS: -framework foundation 2 + 3 + // Bugs found: 4 + // objc_superrefs not properly fixed at load time 5 + 6 + #import <Foundation/NSObject.h> 7 + #include <stdio.h> 8 + #include <objc/runtime.h> 9 + 10 + @interface baseclass : NSObject 11 + +(long double)test; 12 + @end 13 + 14 + @interface subclass : baseclass 15 + +(long double)test; 16 + @end 17 + 18 + @implementation baseclass 19 + +(long double)test 20 + { 21 + puts("Test called"); 22 + return 5.0; 23 + } 24 + @end 25 + 26 + @implementation subclass 27 + +(long double)test 28 + { 29 + long double v = [super test]; 30 + printf("After supercall: %Lf\n", v); 31 + v += 1.0; 32 + return v; 33 + } 34 + @end 35 + 36 + int main() 37 + { 38 + long double v = [subclass test]; 39 + printf("Return value: %Lf\n", v); 40 + return 0; 41 + } 42 +
+3
tests/src/objc_stret.m
··· 1 1 #include <stdio.h> 2 + #include <assert.h> 2 3 #import <Foundation/NSObject.h> 3 4 4 5 struct st ··· 16 17 @implementation helloclass 17 18 + (struct st)mult:(float)a :(float)b 18 19 { 20 + assert(self == [helloclass class]); 21 + 19 22 struct st s; 20 23 s.f1 = a+b; 21 24 return s;