]> git.saurik.com Git - apple/objc4.git/blob - test/evil-category-def.m
objc4-493.9.tar.gz
[apple/objc4.git] / test / evil-category-def.m
1
2 #if __OBJC2__
3
4 #include <mach/shared_region.h>
5
6 #if __LP64__
7 # define PTR " .quad "
8 #else
9 # define PTR " .long "
10 #endif
11
12 #define str(x) #x
13 #define str2(x) str(x)
14
15 __BEGIN_DECLS
16 void nop(void) { }
17 __END_DECLS
18
19 asm(
20 ".globl L_category \n"
21 ".section __DATA,__objc_data \n"
22 ".align 3 \n"
23 "L_category: \n"
24 PTR "L_cat_name \n"
25 PTR "_OBJC_CLASS_$_NSObject \n"
26 #if EVIL_INSTANCE_METHOD
27 PTR "L_evil_methods \n"
28 #else
29 PTR "L_good_methods \n"
30 #endif
31 #if EVIL_CLASS_METHOD
32 PTR "L_evil_methods \n"
33 #else
34 PTR "L_good_methods \n"
35 #endif
36 PTR "0 \n"
37 PTR "0 \n"
38
39 "L_evil_methods: \n"
40 ".long 24 \n"
41 ".long 1 \n"
42 PTR "L_load \n"
43 PTR "L_load \n"
44 PTR str2(SHARED_REGION_BASE+SHARED_REGION_SIZE-0x1000) " \n"
45
46 "L_good_methods: \n"
47 ".long 24 \n"
48 ".long 1 \n"
49 PTR "L_load \n"
50 PTR "L_load \n"
51 PTR "_nop \n"
52
53 ".cstring \n"
54 "L_cat_name: .ascii \"Evil\\0\" \n"
55 "L_load: .ascii \"load\\0\" \n"
56
57 ".section __DATA,__objc_catlist \n"
58 #if !OMIT_CAT
59 PTR "L_category \n"
60 #endif
61
62 ".section __DATA,__objc_nlcatlist \n"
63 #if !OMIT_NL_CAT
64 PTR "L_category \n"
65 #endif
66
67 );
68
69 // __OBJC2__
70 #endif
71
72 void fn(void) { }