]>
git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/interpose-weak.dtest/main.c
1 // BUILD: $CC foo.c -dynamiclib -o $BUILD_DIR/libfoo.dylib -install_name $RUN_DIR/libfoo.dylib
2 // BUILD: $CC main.c $BUILD_DIR/libfoo.dylib -o $BUILD_DIR/interpose-weak-present.exe
3 // BUILD: $CC interposer.c -dynamiclib $BUILD_DIR/libfoo.dylib -o $BUILD_DIR/libinterposer.dylib -install_name libinterposer.dylib
5 // BUILD: $CC foo.c -dynamiclib -o $TEMP_DIR/libfoo2.dylib -install_name $RUN_DIR/libfoo2.dylib
6 // BUILD: $CC foo.c -DNO_FOO34 -dynamiclib -o $BUILD_DIR/libfoo2.dylib -install_name $RUN_DIR/libfoo2.dylib
7 // BUILD: $CC main.c -DNO_FOO34 $TEMP_DIR/libfoo2.dylib -o $BUILD_DIR/interpose-weak-missing.exe
8 // BUILD: $CC interposer.c -dynamiclib $TEMP_DIR/libfoo2.dylib -o $BUILD_DIR/libinterposer2.dylib -install_name libinterposer.dylib
11 // RUN: DYLD_INSERT_LIBRARIES=libinterposer.dylib ./interpose-weak-present.exe
12 // RUN: DYLD_INSERT_LIBRARIES=libinterposer2.dylib ./interpose-weak-missing.exe
23 extern int foo3() __attribute__((weak_import
));
24 extern int foo4() __attribute__((weak_import
));
27 #define MODE "present"
29 #define MODE "missing"
34 printf("[BEGIN] interpose-weak-" MODE
"\n");
37 printf("[FAIL] interpose-weak-" MODE
", foo1() != 1\n");
42 printf("[FAIL] interpose-weak-" MODE
", foo2() != 12\n");
48 printf("[FAIL] interpose-weak-" MODE
", foo3() != 3\n");
53 printf("[FAIL] interpose-weak-" MODE
", foo4() != 14\n");
57 if ( &foo3
!= NULL
) {
58 printf("[FAIL] interpose-weak-" MODE
", &foo3 != NULL\n");
62 if ( &foo4
!= NULL
) {
63 printf("[FAIL] interpose-weak-" MODE
", &foo4 != NULL\n");
68 printf("[PASS] interpose-weak-" MODE
"\n");