3 // BUILD: $CC main.m -o $BUILD_DIR/_dyld_get_objc_selector-chained.exe -lobjc -Wl,-fixup_chains
5 // RUN: ./_dyld_get_objc_selector-chained.exe
7 #include <mach-o/dyld_priv.h>
9 #import <Foundation/Foundation.h>
11 @interface DyldClass : NSObject
14 @implementation DyldClass
15 -(void) dyldClassFoo {
18 +(void) dyldClassFoo {
23 @interface DyldMainClass : NSObject
26 @implementation DyldMainClass
27 -(void) dyldMainClassFoo {
30 -(void) dyldMainClassFoo2 {
35 extern int printf(const char*, ...);
37 extern id objc_getClass(const char *name);
40 printf("[BEGIN] _dyld_get_objc_selector-chained\n");
43 const char* sel = _dyld_get_objc_selector("dyldClassFoo");
45 if ((SEL)sel != @selector(dyldClassFoo)) {
46 printf("[FAIL] _dyld_get_objc_selector-chained: dyldClassFoo is wrong\n");
52 sel = _dyld_get_objc_selector("dyldMainClassFoo");
54 if ((SEL)sel != @selector(dyldMainClassFoo)) {
55 printf("[FAIL] _dyld_get_objc_selector-chained: dyldMainClassFoo is wrong\n");
61 sel = _dyld_get_objc_selector("dyldMainClassFoo2");
63 if ((SEL)sel != @selector(dyldMainClassFoo2)) {
64 printf("[FAIL] _dyld_get_objc_selector-chained: dyldMainClassFoo2 is wrong\n");
69 printf("[PASS] _dyld_get_objc_selector-chained\n");