]> git.saurik.com Git - apple/objc4.git/blob - test/evil-category-def.m
objc4-680.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 ".section __DATA,__objc_data \n"
21 ".align 3 \n"
22 "L_category: \n"
23 PTR "L_cat_name \n"
24 PTR "_OBJC_CLASS_$_NSObject \n"
25 #if EVIL_INSTANCE_METHOD
26 PTR "L_evil_methods \n"
27 #else
28 PTR "L_good_methods \n"
29 #endif
30 #if EVIL_CLASS_METHOD
31 PTR "L_evil_methods \n"
32 #else
33 PTR "L_good_methods \n"
34 #endif
35 PTR "0 \n"
36 PTR "0 \n"
37
38 "L_evil_methods: \n"
39 ".long 24 \n"
40 ".long 1 \n"
41 PTR "L_load \n"
42 PTR "L_load \n"
43 PTR str2(SHARED_REGION_BASE+SHARED_REGION_SIZE-PAGE_MAX_SIZE) " \n"
44
45 "L_good_methods: \n"
46 ".long 24 \n"
47 ".long 1 \n"
48 PTR "L_load \n"
49 PTR "L_load \n"
50 PTR "_nop \n"
51
52 ".cstring \n"
53 "L_cat_name: .ascii \"Evil\\0\" \n"
54 "L_load: .ascii \"load\\0\" \n"
55
56 ".section __DATA,__objc_catlist \n"
57 #if !OMIT_CAT
58 PTR "L_category \n"
59 #endif
60
61 ".section __DATA,__objc_nlcatlist \n"
62 #if !OMIT_NL_CAT
63 PTR "L_category \n"
64 #endif
65
66 ".text \n"
67 );
68
69 // __OBJC2__
70 #endif
71
72 void fn(void) { }