]>
git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/_dyld_get_objc_selector-shared-cache.dtest/main.c
d11e4421f3b1d1ec4b1cc59fb39b423506a241fe
2 // BUILD: $CC main.c -o $BUILD_DIR/_dyld_get_objc_selector-shared-cache.exe
4 // RUN: ./_dyld_get_objc_selector-shared-cache.exe
9 #include <mach-o/dyld.h>
10 #include <mach-o/dyld_priv.h>
15 printf("[BEGIN] _dyld_get_objc_selector-shared-cache\n");
18 uintptr_t cacheStart
= (uintptr_t)_dyld_get_shared_cache_range(&cacheLen
);
20 const char* selName
= _dyld_get_objc_selector("retain");
22 if ( cacheStart
!= 0 ) {
23 // We have a shared cache, so the selector should be there
24 if ( selName
== NULL
) {
25 printf("[FAIL] _dyld_get_objc_selector() returned null for selector in shared cache\n");
29 if ( ((uintptr_t)selName
< cacheStart
) || ((uintptr_t)selName
>= (cacheStart
+ cacheLen
)) ) {
30 printf("[FAIL] _dyld_get_objc_selector() pointer outside of shared cache range\n");
34 // No shared cache, so the selector should not be found.
35 // FIXME: This assumption may be false once the selectors are in the closure.
36 if ( selName
!= NULL
) {
37 printf("[FAIL] _dyld_get_objc_selector() returned non-null for selector without shared cache\n");
42 printf("[PASS] _dyld_get_objc_selector-shared-cache\n");