]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/upward-links-initializers.dtest/main.c
dyld-851.27.tar.gz
[apple/dyld.git] / testing / test-cases / upward-links-initializers.dtest / main.c
1 // BUILD: $CC value.c -dynamiclib -install_name $RUN_DIR/libvalue.dylib -o $BUILD_DIR/libvalue.dylib
2 // BUILD: $CC init4.c -dynamiclib -install_name $RUN_DIR/libinit4.dylib -o $BUILD_DIR/libinit4.dylib $BUILD_DIR/libvalue.dylib
3 // BUILD: $CC init5.c -dynamiclib -install_name $RUN_DIR/libinit5.dylib -o $BUILD_DIR/libinit5.dylib $BUILD_DIR/libinit4.dylib $BUILD_DIR/libvalue.dylib
4 // BUILD: $CC init6.c -dynamiclib -install_name $RUN_DIR/libinit6.dylib -o $BUILD_DIR/libinit6.dylib $BUILD_DIR/libinit5.dylib $BUILD_DIR/libvalue.dylib
5 // BUILD: $CC init1.c -dynamiclib -install_name $RUN_DIR/libinit1.dylib -o $BUILD_DIR/libinit1.dylib -Wl,-upward_library,$BUILD_DIR/libinit6.dylib $BUILD_DIR/libvalue.dylib
6 // BUILD: $CC init2.c -dynamiclib -install_name $RUN_DIR/libinit2.dylib -o $BUILD_DIR/libinit2.dylib $BUILD_DIR/libinit1.dylib $BUILD_DIR/libvalue.dylib
7 // BUILD: $CC init3.c -dynamiclib -install_name $RUN_DIR/libinit3.dylib -o $BUILD_DIR/libinit3.dylib $BUILD_DIR/libinit2.dylib $BUILD_DIR/libvalue.dylib
8 // BUILD: $CC main.c -o $BUILD_DIR/upward-link-initializers.exe -DRUN_DIR="$RUN_DIR" $BUILD_DIR/libinit3.dylib
9
10
11 /*
12 * main ---> libinit3
13 * |
14 * -------|
15 * libinit6 libinit2
16 * | ^ |
17 * | | |
18 * | | |
19 * libinit5 -----------libinit1
20 * |
21 * |
22 * libinit4
23 *
24 * libinit1: lowest direct dependency from top level lib (libinit3)
25 * libinit6: only ever brought via upward link dependency, and should not be initialized before libinit1
26 * libinit4: lowest direct dependency from dangling upward (libinit6)
27 */
28
29 // RUN: ./upward-link-initializers.exe
30
31
32 #include <stdio.h>
33 #include <dlfcn.h>
34 #include <stdlib.h>
35
36 #include "test_support.h"
37
38 int main(int argc, const char* argv[], const char* envp[]) {
39 // Initializers tests passed
40 PASS("Success");
41 }
42