]>
git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/_dyld_get_objc_selector-shared-cache.dtest/main.c
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>
12 #include "test_support.h"
14 int main(int argc
, const char* argv
[], const char* envp
[], const char* apple
[]) {
16 uintptr_t cacheStart
= (uintptr_t)_dyld_get_shared_cache_range(&cacheLen
);
18 const char* selName
= _dyld_get_objc_selector("retain");
20 if ( cacheStart
!= 0 ) {
21 // We have a shared cache, so the selector should be there
22 if ( selName
== NULL
) {
23 FAIL("_dyld_get_objc_selector() returned null for selector in shared cache");
26 if ( ((uintptr_t)selName
< cacheStart
) || ((uintptr_t)selName
>= (cacheStart
+ cacheLen
)) ) {
27 FAIL("_dyld_get_objc_selector() pointer outside of shared cache range");
30 // No shared cache, so the selector should not be found.
31 // FIXME: This assumption may be false once the selectors are in the closure.
32 if ( selName
!= NULL
) {
33 FAIL("_dyld_get_objc_selector() returned non-null for selector without shared cache");