123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321 |
- #include <sys/cdefs.h>
- #if __LP64__
- # define PTR " .quad "
- # define PTRSIZE "8"
- # define LOGPTRSIZE "3"
- #else
- # define PTR " .long "
- # define PTRSIZE "4"
- # define LOGPTRSIZE "2"
- #endif
- #if __has_feature(ptrauth_calls)
- # define SIGNED_METHOD_LIST_IMP "@AUTH(ia,0,addr) "
- #else
- # define SIGNED_METHOD_LIST_IMP
- #endif
- #define str(x) #x
- #define str2(x) str(x)
- __BEGIN_DECLS
- // not id to avoid ARC operations because the class doesn't implement RR methods
- void* nop(void* self) { return self; }
- __END_DECLS
- asm(
- ".globl _OBJC_CLASS_$_Super \n"
- ".section __DATA,__objc_data \n"
- ".align 3 \n"
- "_OBJC_CLASS_$_Super: \n"
- PTR "_OBJC_METACLASS_$_Super \n"
- PTR "0 \n"
- PTR "__objc_empty_cache \n"
- PTR "0 \n"
- PTR "L_ro \n"
- // pad to OBJC_MAX_CLASS_SIZE
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- ""
- "_OBJC_METACLASS_$_Super: \n"
- PTR "_OBJC_METACLASS_$_Super \n"
- PTR "_OBJC_CLASS_$_Super \n"
- PTR "__objc_empty_cache \n"
- PTR "0 \n"
- PTR "L_meta_ro \n"
- // pad to OBJC_MAX_CLASS_SIZE
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- ""
- "L_ro: \n"
- ".long 2 \n"
- ".long 0 \n"
- ".long " PTRSIZE " \n"
- #if __LP64__
- ".long 0 \n"
- #endif
- PTR "0 \n"
- PTR "L_super_name \n"
- #if EVIL_SUPER
- PTR "L_evil_methods \n"
- #else
- PTR "L_good_methods \n"
- #endif
- PTR "0 \n"
- PTR "L_super_ivars \n"
- PTR "0 \n"
- PTR "0 \n"
- ""
- "L_meta_ro: \n"
- ".long 3 \n"
- ".long 40 \n"
- ".long 40 \n"
- #if __LP64__
- ".long 0 \n"
- #endif
- PTR "0 \n"
- PTR "L_super_name \n"
- #if EVIL_SUPER_META
- PTR "L_evil_methods \n"
- #else
- PTR "L_good_methods \n"
- #endif
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- ".globl _OBJC_CLASS_$_Sub \n"
- ".section __DATA,__objc_data \n"
- ".align 3 \n"
- "_OBJC_CLASS_$_Sub: \n"
- PTR "_OBJC_METACLASS_$_Sub \n"
- PTR "_OBJC_CLASS_$_Super \n"
- PTR "__objc_empty_cache \n"
- PTR "0 \n"
- PTR "L_sub_ro \n"
- // pad to OBJC_MAX_CLASS_SIZE
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- ""
- "_OBJC_METACLASS_$_Sub: \n"
- PTR "_OBJC_METACLASS_$_Super \n"
- PTR "_OBJC_METACLASS_$_Super \n"
- PTR "__objc_empty_cache \n"
- PTR "0 \n"
- PTR "L_sub_meta_ro \n"
- // pad to OBJC_MAX_CLASS_SIZE
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- ""
- "L_sub_ro: \n"
- ".long 2 \n"
- ".long 0 \n"
- ".long " PTRSIZE " \n"
- #if __LP64__
- ".long 0 \n"
- #endif
- PTR "0 \n"
- PTR "L_sub_name \n"
- #if EVIL_SUB
- PTR "L_evil_methods \n"
- #else
- PTR "L_good_methods \n"
- #endif
- PTR "0 \n"
- PTR "L_sub_ivars \n"
- PTR "0 \n"
- PTR "0 \n"
- ""
- "L_sub_meta_ro: \n"
- ".long 3 \n"
- ".long 40 \n"
- ".long 40 \n"
- #if __LP64__
- ".long 0 \n"
- #endif
- PTR "0 \n"
- PTR "L_sub_name \n"
- #if EVIL_SUB_META
- PTR "L_evil_methods \n"
- #else
- PTR "L_good_methods \n"
- #endif
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- PTR "0 \n"
- "L_evil_methods: \n"
- ".long 3*" PTRSIZE " \n"
- ".long 1 \n"
- PTR "L_load \n"
- PTR "L_load \n"
- PTR "_abort" SIGNED_METHOD_LIST_IMP "\n"
- // assumes that abort is inside the dyld shared cache
- "L_good_methods: \n"
- ".long 3*" PTRSIZE " \n"
- ".long 2 \n"
- PTR "L_load \n"
- PTR "L_load \n"
- PTR "_nop" SIGNED_METHOD_LIST_IMP "\n"
- PTR "L_self \n"
- PTR "L_self \n"
- PTR "_nop" SIGNED_METHOD_LIST_IMP "\n"
- "L_super_ivars: \n"
- ".long 4*" PTRSIZE " \n"
- ".long 1 \n"
- PTR "L_super_ivar_offset \n"
- PTR "L_super_ivar_name \n"
- PTR "L_super_ivar_type \n"
- ".long " LOGPTRSIZE " \n"
- ".long " PTRSIZE " \n"
- "L_sub_ivars: \n"
- ".long 4*" PTRSIZE " \n"
- ".long 1 \n"
- PTR "L_sub_ivar_offset \n"
- PTR "L_sub_ivar_name \n"
- PTR "L_sub_ivar_type \n"
- ".long " LOGPTRSIZE " \n"
- ".long " PTRSIZE " \n"
- "L_super_ivar_offset: \n"
- ".long 0 \n"
- "L_sub_ivar_offset: \n"
- ".long " PTRSIZE " \n"
- ".cstring \n"
- "L_super_name: .ascii \"Super\\0\" \n"
- "L_sub_name: .ascii \"Sub\\0\" \n"
- "L_load: .ascii \"load\\0\" \n"
- "L_self: .ascii \"self\\0\" \n"
- "L_super_ivar_name: .ascii \"super_ivar\\0\" \n"
- "L_super_ivar_type: .ascii \"c\\0\" \n"
- "L_sub_ivar_name: .ascii \"sub_ivar\\0\" \n"
- "L_sub_ivar_type: .ascii \"@\\0\" \n"
- ".section __DATA,__objc_classlist \n"
- #if !OMIT_SUPER
- PTR "_OBJC_CLASS_$_Super \n"
- #endif
- #if !OMIT_SUB
- PTR "_OBJC_CLASS_$_Sub \n"
- #endif
- ".section __DATA,__objc_nlclslist \n"
- #if !OMIT_NL_SUPER
- PTR "_OBJC_CLASS_$_Super \n"
- #endif
- #if !OMIT_NL_SUB
- PTR "_OBJC_CLASS_$_Sub \n"
- #endif
- ".text \n"
- );
- void fn(void) { }
|