xref: /llvm-project/compiler-rt/test/orc/TestCases/Windows/x86-64/priority-static-initializer-three.c (revision 73c4033987c5ca6cf8022f840f3c42e3324da1cb)
1 // RUN: %clang_cl -MD -c -o %t %s
2 // RUN: %llvm_jitlink %t 2>&1 | FileCheck %s
3 // CHECK: init1
4 // CHECK-NEXT: init2
5 // CHECK-NEXT: init3
6 
7 #include <stdio.h>
8 
init1()9 int init1() {
10   printf("init1\n");
11   return 0;
12 }
13 
init2()14 int init2() {
15   printf("init2\n");
16   return 0;
17 }
18 
init3()19 int init3() {
20   printf("init3\n");
21   return 0;
22 }
23 
24 #pragma section(".CRT$XIX", long, read)
25 __declspec(allocate(".CRT$XIX")) int (*i3)(void) = init3;
26 
27 #pragma section(".CRT$XIV", long, read)
28 __declspec(allocate(".CRT$XIV")) int (*i1)(void) = init1;
29 
30 #pragma section(".CRT$XIW", long, read)
31 __declspec(allocate(".CRT$XIW")) int (*i2)(void) = init2;
32 
main(int argc,char * argv[])33 int main(int argc, char *argv[]) {
34   fflush(stdout);
35   return 0;
36 }
37