]>
git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/interpose-weak.dtest/main.c
52484276d2453041bcf842907c668aec324bae61
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: $DYLD_ENV_VARS_ENABLE $BUILD_DIR/interpose-weak-present.exe
4 // BUILD: $CC interposer.c -dynamiclib $BUILD_DIR/libfoo.dylib -o $BUILD_DIR/libinterposer.dylib -install_name libinterposer.dylib
6 // BUILD: $CC foo.c -dynamiclib -o $TEMP_DIR/libfoo2.dylib -install_name $RUN_DIR/libfoo2.dylib
7 // BUILD: $CC foo.c -DNO_FOO34 -dynamiclib -o $BUILD_DIR/libfoo2.dylib -install_name $RUN_DIR/libfoo2.dylib
8 // BUILD: $CC main.c -DNO_FOO34 $TEMP_DIR/libfoo2.dylib -o $BUILD_DIR/interpose-weak-missing.exe
9 // BUILD: $DYLD_ENV_VARS_ENABLE $BUILD_DIR/interpose-weak-missing.exe
10 // BUILD: $CC interposer.c -dynamiclib $TEMP_DIR/libfoo2.dylib -o $BUILD_DIR/libinterposer2.dylib -install_name libinterposer.dylib
13 // RUN: DYLD_INSERT_LIBRARIES=libinterposer.dylib ./interpose-weak-present.exe
14 // RUN: DYLD_INSERT_LIBRARIES=libinterposer2.dylib ./interpose-weak-missing.exe
25 extern int foo3() __attribute__((weak_import
));
26 extern int foo4() __attribute__((weak_import
));
29 #define MODE "present"
31 #define MODE "missing"
36 printf("[BEGIN] interpose-weak-" MODE
"\n");
39 printf("[FAIL] interpose-weak-" MODE
", foo1() != 1\n");
44 printf("[FAIL] interpose-weak-" MODE
", foo2() != 12\n");
50 printf("[FAIL] interpose-weak-" MODE
", foo3() != 3\n");
55 printf("[FAIL] interpose-weak-" MODE
", foo4() != 14\n");
59 if ( &foo3
!= NULL
) {
60 printf("[FAIL] interpose-weak-" MODE
", &foo3 != NULL\n");
64 if ( &foo4
!= NULL
) {
65 printf("[FAIL] interpose-weak-" MODE
", &foo4 != NULL\n");
70 printf("[PASS] interpose-weak-" MODE
"\n");