]> git.saurik.com Git - apple/dyld.git/blob - unit-tests/test-cases/weak-coalesce-stubs/main.c
dyld-239.3.tar.gz
[apple/dyld.git] / unit-tests / test-cases / weak-coalesce-stubs / main.c
1 #include <stdio.h>
2 #include <dlfcn.h>
3 #include <stdlib.h> // exit(), EXIT_SUCCESS
4
5 #include "test.h" // PASS(), FAIL(), XPASS(), XFAIL()
6
7 //<rdar://problem/7886402> Loading MH_DYLIB_STUB causing coalescable miscount
8
9 int main()
10 {
11 // try to load stub many times
12 for (int i=0; i < 10; ++i) {
13 void* handle = dlopen("libstub.dylib", RTLD_LAZY);
14 if ( handle != NULL ) {
15 FAIL("weak-coalesce-stubs: load of libstub.dylib unexpectedly succeeded");
16 }
17 }
18 // try to load real dylib
19 dlopen("libbar.dylib", RTLD_LAZY);
20 PASS("weak-coalesce-stubs");
21 return 0;
22 }