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 | |
9 | int init1() { |
10 | printf(format: "init1\n" ); |
11 | return 0; |
12 | } |
13 | |
14 | int init2() { |
15 | printf(format: "init2\n" ); |
16 | return 0; |
17 | } |
18 | |
19 | int init3() { |
20 | printf(format: "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 | |
33 | int main(int argc, char *argv[]) { |
34 | fflush(stdout); |
35 | return 0; |
36 | } |
37 | |