]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/missing-weak-def.dtest/main.c
b4921cd45d1b7af4c12e6fb0ad05eee7d7f85bfb
[apple/dyld.git] / testing / test-cases / missing-weak-def.dtest / main.c
1
2 // BUILD: $CC bar.c -dynamiclib -install_name $RUN_DIR/libbar.dylib -o $TEMP_DIR/libbar.dylib
3 // BUILD: $CC bar-empty.c -dynamiclib -install_name $BUILD_DIR/libbar.dylib -o $BUILD_DIR/libbar.dylib
4 // BUILD: $CC main.c $TEMP_DIR/libbar.dylib -o $BUILD_DIR/missing-weak-def.exe
5
6 // RUN: ./missing-weak-def.exe
7
8 // bar is a weak_import weak bind and the libbar we have at runtime is missing that symbol
9
10
11 #include <stdio.h>
12 #include <stdlib.h>
13
14 __attribute__((weak))
15 __attribute__((weak_import))
16 int bar();
17
18 int main()
19 {
20 printf("[BEGIN] missing-weak-def\n");
21
22 if (&bar) {
23 printf("[FAIL] missing-weak-def\n");
24 return 0;
25 }
26
27 printf("[PASS] missing-weak-def\n");
28 return 0;
29 }
30