1 // Test whether or not the driver instructs the backend to use .init_array
2 // sections for global constructors.
3 //
4 // CHECK-INIT-ARRAY-NOT: -fno-use-init-array
5 // CHECK-NO-INIT-ARRAY: -fno-use-init-array
6 //
7 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
8 // RUN:     -target i386-unknown-linux \
9 // RUN:     --sysroot=%S/Inputs/resource_dir \
10 // RUN:     --gcc-toolchain="" \
11 // RUN:   | FileCheck --check-prefix=CHECK-INIT-ARRAY %s
12 //
13 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
14 // RUN:     -target i386-unknown-linux \
15 // RUN:     --sysroot=%S/Inputs/fake_install_tree \
16 // RUN:     --gcc-toolchain="" \
17 // RUN:   | FileCheck --check-prefix=CHECK-INIT-ARRAY %s
18 //
19 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
20 // RUN:     -fno-use-init-array \
21 // RUN:     -target i386-unknown-linux \
22 // RUN:     --sysroot=%S/Inputs/fake_install_tree \
23 // RUN:     --gcc-toolchain="" \
24 // RUN:   | FileCheck --check-prefix=CHECK-NO-INIT-ARRAY %s
25 //
26 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
27 // RUN:     -fno-use-init-array -fuse-init-array \
28 // RUN:     -target i386-unknown-linux \
29 // RUN:     --sysroot=%S/Inputs/fake_install_tree \
30 // RUN:     --gcc-toolchain="" \
31 // RUN:   | FileCheck --check-prefix=CHECK-INIT-ARRAY %s
32 //
33 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
34 // RUN:     -target i386-unknown-linux \
35 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
36 // RUN:     --gcc-toolchain="" \
37 // RUN:   | FileCheck --check-prefix=CHECK-INIT-ARRAY %s
38 //
39 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
40 // RUN:     -fuse-init-array \
41 // RUN:     -target i386-unknown-linux \
42 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
43 // RUN:     --gcc-toolchain="" \
44 // RUN:   | FileCheck --check-prefix=CHECK-INIT-ARRAY %s
45 //
46 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
47 // RUN:     -target arm-unknown-linux-androideabi \
48 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
49 // RUN:     --gcc-toolchain="" \
50 // RUN:   | FileCheck --check-prefix=CHECK-INIT-ARRAY %s
51 //
52 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
53 // RUN:     -target mipsel-unknown-linux-android \
54 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
55 // RUN:     --gcc-toolchain="" \
56 // RUN:   | FileCheck --check-prefix=CHECK-INIT-ARRAY %s
57 //
58 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
59 // RUN:     -target i386-unknown-linux-android \
60 // RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
61 // RUN:     --gcc-toolchain="" \
62 // RUN:   | FileCheck --check-prefix=CHECK-INIT-ARRAY %s
63 //
64 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
65 // RUN:     -target aarch64-none-linux-gnu \
66 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
67 // RUN:     --gcc-toolchain="" \
68 // RUN:   | FileCheck --check-prefix=CHECK-INIT-ARRAY %s
69 //
70 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
71 // RUN:     -target aarch64-none-none-eabi \
72 // RUN:   | FileCheck --check-prefix=CHECK-INIT-ARRAY %s
73 
74 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
75 // RUN:     -target arm64-none-linux-gnu \
76 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
77 // RUN:     --gcc-toolchain="" \
78 // RUN:   | FileCheck --check-prefix=CHECK-INIT-ARRAY %s
79 //
80 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
81 // RUN:     -target arm64-none-none-eabi \
82 // RUN:   | FileCheck --check-prefix=CHECK-INIT-ARRAY %s
83 
84 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
85 // RUN:     -target i386-unknown-freebsd11 \
86 // RUN:   | FileCheck --check-prefix=CHECK-NO-INIT-ARRAY %s
87 
88 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1       \
89 // RUN:     -target i386-unknown-freebsd12 \
90 // RUN:   | FileCheck --check-prefix=CHECK-INIT-ARRAY %s
91 //
92 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1        \
93 // RUN:     -target sparc-sun-solaris2.11 \
94 // RUN:   | FileCheck --check-prefix=CHECK-INIT-ARRAY %s
95 //
96 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1        \
97 // RUN:     -target i386-pc-solaris2.11 \
98 // RUN:   | FileCheck --check-prefix=CHECK-INIT-ARRAY %s
99