[RISCV][FMV] Support target_clones (#85786)
[llvm-project.git] / clang / test / Driver / pic.c
blobf5d0745422790629bb5dc55812df2f28e4ae9bb1
1 // Test the driver's control over the PIC behavior. These mainly consist of
2 // tests of the relocation model flags and the pic level flags passed to CC1.
3 //
4 // CHECK-NO-PIC: "-mrelocation-model" "static"
5 // CHECK-NO-PIC-NOT: "-pic-level"
6 // CHECK-NO-PIC-NOT: "-pic-is-pie"
7 //
8 // CHECK-PIC1: "-mrelocation-model" "pic"
9 // CHECK-PIC1: "-pic-level" "1"
10 // CHECK-PIC1-NOT: "-pic-is-pie"
12 // CHECK-PIC2: "-mrelocation-model" "pic"
13 // CHECK-PIC2: "-pic-level" "2"
14 // CHECK-PIC2-NOT: "-pic-is-pie"
16 // CHECK-STATIC: "-static"
17 // CHECK-NO-STATIC-NOT: "-static"
19 // CHECK-PIE1: "-mrelocation-model" "pic"
20 // CHECK-PIE1: "-pic-level" "1"
21 // CHECK-PIE1: "-pic-is-pie"
23 // CHECK-PIE2: "-mrelocation-model" "pic"
24 // CHECK-PIE2: "-pic-level" "2"
25 // CHECK-PIE2: "-pic-is-pie"
27 // CHECK-PIE-LD: "{{.*}}ld{{(.exe)?}}"
28 // CHECK-PIE-LD: "-pie"
29 // CHECK-PIE-LD: "Scrt1.o" "crti.o" "crtbeginS.o"
30 // CHECK-PIE-LD: "crtendS.o" "crtn.o"
32 // CHECK-NOPIE-LD: "-nopie"
34 // CHECK-DYNAMIC-NO-PIC-32: "-mrelocation-model" "dynamic-no-pic"
35 // CHECK-DYNAMIC-NO-PIC-32-NOT: "-pic-level"
36 // CHECK-DYNAMIC-NO-PIC-32-NOT: "-pic-is-pie"
38 // CHECK-DYNAMIC-NO-PIC-64: "-mrelocation-model" "dynamic-no-pic"
39 // CHECK-DYNAMIC-NO-PIC-64: "-pic-level" "2"
40 // CHECK-DYNAMIC-NO-PIC-64-NOT: "-pic-is-pie"
42 // CHECK-NON-DARWIN-DYNAMIC-NO-PIC: error: unsupported option '-mdynamic-no-pic' for target 'i386-unknown-unknown'
44 // CHECK-NO-PIE-NOT: "-pie"
46 // CHECK-NO-UNUSED-ARG-NOT: argument unused during compilation
48 // CHECK-NO-PIC-DATA-TEXT-REL: "-mcmodel=medium"
49 // CHECK-PIC-DATA-TEXT-REL-NOT: "-mcmodel=medium"
50 // CHECK-NO-PIC-DATA-TEXT-REL-NON-SYSTEMZ: error: unsupported option '-mno-pic-data-is-text-relative' for target 'arm-arm-none-eabi'
51 // CHECK-PIC-DATA-TEXT-REL-NON-SYSTEMZ: error: unsupported option '-mpic-data-is-text-relative' for target 'arm-arm-none-eabi'
53 // RUN: %clang -c %s -target i386-unknown-unknown -### 2>&1 \
54 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
55 // RUN: %clang -c %s -target i386-unknown-unknown -fpic -### 2>&1 \
56 // RUN: | FileCheck %s --check-prefix=CHECK-PIC1
57 // RUN: %clang -c %s -target i386-unknown-unknown -fPIC -### 2>&1 \
58 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
59 // RUN: %clang -c %s -target i386-unknown-unknown -fpie -### 2>&1 \
60 // RUN: | FileCheck %s --check-prefix=CHECK-PIE1
61 // RUN: %clang -c %s -target i386-unknown-unknown -fPIE -### 2>&1 \
62 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
64 // Check that PIC and PIE flags obey last-match-wins. If the last flag is
65 // a no-* variant, regardless of which variant or which flags precede it, we
66 // get no PIC.
67 // RUN: %clang -c %s -target i386-unknown-unknown -fpic -fno-pic -### 2>&1 \
68 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
69 // RUN: %clang -c %s -target i386-unknown-unknown -fPIC -fno-pic -### 2>&1 \
70 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
71 // RUN: %clang -c %s -target i386-unknown-unknown -fpie -fno-pic -### 2>&1 \
72 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
73 // RUN: %clang -c %s -target i386-unknown-unknown -fPIE -fno-pic -### 2>&1 \
74 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
75 // RUN: %clang -c %s -target i386-unknown-unknown -fpic -fno-PIC -### 2>&1 \
76 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
77 // RUN: %clang -c %s -target i386-unknown-unknown -fPIC -fno-PIC -### 2>&1 \
78 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
79 // RUN: %clang -c %s -target i386-unknown-unknown -fpie -fno-PIC -### 2>&1 \
80 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
81 // RUN: %clang -c %s -target i386-unknown-unknown -fPIE -fno-PIC -### 2>&1 \
82 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
83 // RUN: %clang -c %s -target i386-unknown-unknown -fpic -fno-pie -### 2>&1 \
84 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
85 // RUN: %clang -c %s -target i386-unknown-unknown -fPIC -fno-pie -### 2>&1 \
86 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
87 // RUN: %clang -c %s -target i386-unknown-unknown -fpie -fno-pie -### 2>&1 \
88 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
89 // RUN: %clang -c %s -target i386-unknown-unknown -fPIE -fno-pie -### 2>&1 \
90 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
91 // RUN: %clang -c %s -target i386-unknown-unknown -fpic -fno-PIE -### 2>&1 \
92 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
93 // RUN: %clang -c %s -target i386-unknown-unknown -fPIC -fno-PIE -### 2>&1 \
94 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
95 // RUN: %clang -c %s -target i386-unknown-unknown -fpie -fno-PIE -### 2>&1 \
96 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
97 // RUN: %clang -c %s -target i386-unknown-unknown -fPIE -fno-PIE -### 2>&1 \
98 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
100 // Last-match-wins where both pic and pie are specified.
101 // RUN: %clang -c %s -target i386-unknown-unknown -fpie -fpic -### 2>&1 \
102 // RUN: | FileCheck %s --check-prefix=CHECK-PIC1
103 // RUN: %clang -c %s -target i386-unknown-unknown -fPIE -fpic -### 2>&1 \
104 // RUN: | FileCheck %s --check-prefix=CHECK-PIC1
105 // RUN: %clang -c %s -target i386-unknown-unknown -fpie -fPIC -### 2>&1 \
106 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
107 // RUN: %clang -c %s -target i386-unknown-unknown -fPIE -fPIC -### 2>&1 \
108 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
109 // RUN: %clang -c %s -target i386-unknown-unknown -fpic -fpie -### 2>&1 \
110 // RUN: | FileCheck %s --check-prefix=CHECK-PIE1
111 // RUN: %clang -c %s -target i386-unknown-unknown -fPIC -fpie -### 2>&1 \
112 // RUN: | FileCheck %s --check-prefix=CHECK-PIE1
113 // RUN: %clang -c %s -target i386-unknown-unknown -fpic -fPIE -### 2>&1 \
114 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
115 // RUN: %clang -c %s -target i386-unknown-unknown -fPIC -fPIE -### 2>&1 \
116 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
118 // Last-match-wins when selecting level 1 vs. level 2.
119 // RUN: %clang -c %s -target i386-unknown-unknown -fpic -fPIC -### 2>&1 \
120 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
121 // RUN: %clang -c %s -target i386-unknown-unknown -fPIC -fpic -### 2>&1 \
122 // RUN: | FileCheck %s --check-prefix=CHECK-PIC1
123 // RUN: %clang -c %s -target i386-unknown-unknown -fpic -fPIE -fpie -### 2>&1 \
124 // RUN: | FileCheck %s --check-prefix=CHECK-PIE1
125 // RUN: %clang -c %s -target i386-unknown-unknown -fpie -fPIC -fPIE -### 2>&1 \
126 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
128 // Make sure -pie is passed to along to ld and that the right *crt* files
129 // are linked in.
130 // RUN: %clang %s -target i386-unknown-freebsd -fPIE -pie -### \
131 // RUN: -rtlib=platform \
132 // RUN: --sysroot=%S/Inputs/basic_freebsd_tree 2>&1 \
133 // RUN: | FileCheck %s --check-prefix=CHECK-PIE-LD
134 // RUN: %clang %s -target i386-linux-gnu -fPIE -pie -### \
135 // RUN: -rtlib=platform --unwindlib=platform \
136 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
137 // RUN: | FileCheck %s --check-prefix=CHECK-PIE-LD
138 // RUN: %clang %s -target i386-linux-gnu -fPIC -pie -### \
139 // RUN: -rtlib=platform --unwindlib=platform \
140 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
141 // RUN: | FileCheck %s --check-prefix=CHECK-PIE-LD
143 // Disregard any of the PIC-specific flags if we have a trump-card flag.
144 // RUN: %clang -c %s -target i386-unknown-unknown -mkernel -fPIC -### 2>&1 \
145 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
147 // The -static argument *doesn't* override PIC: -static only affects
148 // linking, and -fPIC only affects code generation.
149 // RUN: %clang -c %s -target i386-unknown-unknown -static -fPIC -### 2>&1 \
150 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
151 // RUN: %clang %s -target i386-linux-gnu -static -fPIC -### \
152 // RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
153 // RUN: | FileCheck %s --check-prefix=CHECK-STATIC
155 // On Linux, disregard -pie if we have -shared.
156 // RUN: %clang %s -target i386-unknown-linux -shared -pie -### 2>&1 \
157 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIE
159 // On Musl Linux, PIE is enabled by default, but can be disabled.
160 // RUN: %clang -c %s -target x86_64-linux-musl -### 2>&1 \
161 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
162 // RUN: %clang -c %s -target i686-linux-musl -### 2>&1 \
163 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
164 // RUN: %clang -c %s -target armv6-linux-musleabihf -### 2>&1 \
165 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
166 // RUN: %clang -c %s -target armv7-linux-musleabihf -### 2>&1 \
167 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
168 // RUN: %clang %s --target=x86_64-linux-musl -no-pie -### 2>&1 \
169 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIE
170 // RUN: %clang %s --target=x86_64-linux-musl -pie -no-pie -### 2>&1 \
171 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIE
172 // RUN: %clang %s --target=x86_64-linux-musl -no-pie -pie -### 2>&1 \
173 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
175 // Darwin is a beautiful and unique snowflake when it comes to these flags.
176 // When targeting a 32-bit darwin system, only level 2 is supported. On 64-bit
177 // targets, there is simply nothing you can do, there is no PIE, there is only
178 // PIC when it comes to compilation.
179 // RUN: %clang -c %s -target i386-apple-darwin -### 2>&1 \
180 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
181 // RUN: %clang -c %s -target i386-apple-darwin -fpic -### 2>&1 \
182 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
183 // RUN: %clang -c %s -target i386-apple-darwin -fPIC -### 2>&1 \
184 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
185 // RUN: %clang -c %s -target i386-apple-darwin -fpie -### 2>&1 \
186 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
187 // RUN: %clang -c %s -target i386-apple-darwin -fPIE -### 2>&1 \
188 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
189 // RUN: %clang -c %s -target i386-apple-darwin -fno-PIC -### 2>&1 \
190 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
191 // RUN: %clang -c %s -target i386-apple-darwin -fno-PIE -### 2>&1 \
192 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
193 // RUN: %clang -c %s -target i386-apple-darwin -fno-PIC -fpic -### 2>&1 \
194 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
195 // RUN: %clang -c %s -target i386-apple-darwin -fno-PIC -fPIE -### 2>&1 \
196 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
197 // RUN: %clang -c %s -target x86_64-apple-darwin -fno-PIC -### 2>&1 \
198 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
199 // RUN: %clang -c %s -target x86_64-apple-darwin -fno-PIE -### 2>&1 \
200 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
201 // RUN: %clang -c %s -target x86_64-apple-darwin -fpic -### 2>&1 \
202 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
203 // RUN: %clang -c %s -target x86_64-apple-darwin -fPIE -### 2>&1 \
204 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
205 // RUN: %clang -c %s -target x86_64-apple-darwin -fPIC -### 2>&1 \
206 // RUN: | FileCheck %s --check-prefix=CHECK-NO-UNUSED-ARG
208 // Darwin gets even more special with '-mdynamic-no-pic'. This flag is only
209 // valid on Darwin, and it's behavior is very strange but needs to remain
210 // consistent for compatibility.
211 // RUN: not %clang -c %s --target=i386-unknown-unknown -mdynamic-no-pic -### 2>&1 \
212 // RUN: | FileCheck %s --check-prefix=CHECK-NON-DARWIN-DYNAMIC-NO-PIC
213 // RUN: %clang -c %s -target i386-apple-darwin -mdynamic-no-pic -### 2>&1 \
214 // RUN: | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC-32
215 // RUN: %clang -c %s -target i386-apple-darwin -mdynamic-no-pic -fno-pic -### 2>&1 \
216 // RUN: | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC-32
217 // RUN: %clang -c %s -target i386-apple-darwin -mdynamic-no-pic -fpie -### 2>&1 \
218 // RUN: | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC-32
219 // RUN: %clang -c %s -target x86_64-apple-darwin -mdynamic-no-pic -### 2>&1 \
220 // RUN: | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC-64
221 // RUN: %clang -c %s -target x86_64-apple-darwin -mdynamic-no-pic -fno-pic -### 2>&1 \
222 // RUN: | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC-64
223 // RUN: %clang -c %s -target x86_64-apple-darwin -mdynamic-no-pic -fpie -### 2>&1 \
224 // RUN: | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC-64
226 // Checks for ARM+Apple+IOS including -fapple-kext, -mkernel, and iphoneos
227 // version boundaries.
228 // RUN: %clang -c %s -target armv7-apple-ios6 -fapple-kext -### 2>&1 \
229 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
230 // RUN: %clang -c %s -target armv7-apple-ios6 -mkernel -### 2>&1 \
231 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
232 // RUN: %clang -c %s -target arm64-apple-ios7 -mkernel -### 2>&1 \
233 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
234 // RUN: %clang -x assembler -c %s -target arm64-apple-ios7 -mkernel -no-integrated-as -### 2>&1 \
235 // RUN: | FileCheck %s --check-prefix=CHECK-NO-STATIC
236 // RUN: %clang -c %s -target armv7k-apple-watchos1 -fapple-kext -### 2>&1 \
237 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
238 // RUN: %clang -c %s -target x86_64-apple-driverkit -fapple-kext -### 2>&1 \
239 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
240 // RUN: %clang -c %s -target armv7-apple-ios5 -fapple-kext -### 2>&1 \
241 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
242 // RUN: %clang -c %s -target armv7-apple-ios6 -fapple-kext -static -### 2>&1 \
243 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
244 // RUN: %clang -c %s -target armv7-apple-unknown-macho -static -### 2>&1 \
245 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
247 // On OpenBSD, PIE is enabled by default, but can be disabled.
248 // RUN: %clang -c %s -target amd64-pc-openbsd -### 2>&1 \
249 // RUN: | FileCheck %s --check-prefix=CHECK-PIE1
250 // RUN: %clang -c %s -target i386-pc-openbsd -### 2>&1 \
251 // RUN: | FileCheck %s --check-prefix=CHECK-PIE1
252 // RUN: %clang -c %s -target aarch64-unknown-openbsd -### 2>&1 \
253 // RUN: | FileCheck %s --check-prefix=CHECK-PIE1
254 // RUN: %clang -c %s -target arm-unknown-openbsd -### 2>&1 \
255 // RUN: | FileCheck %s --check-prefix=CHECK-PIE1
256 // RUN: %clang -c %s -target mips64-unknown-openbsd -### 2>&1 \
257 // RUN: | FileCheck %s --check-prefix=CHECK-PIE1
258 // RUN: %clang -c %s -target mips64el-unknown-openbsd -### 2>&1 \
259 // RUN: | FileCheck %s --check-prefix=CHECK-PIE1
260 // RUN: %clang -c %s -target powerpc-unknown-openbsd -### 2>&1 \
261 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
262 // RUN: %clang -c %s -target sparc64-unknown-openbsd -### 2>&1 \
263 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
264 // RUN: %clang -c %s -target i386-pc-openbsd -fno-pie -### 2>&1 \
265 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
267 // On OpenBSD, -nopie needs to be passed through to the linker.
268 // RUN: %clang %s -target i386-pc-openbsd -nopie -### 2>&1 \
269 // RUN: | FileCheck %s --check-prefix=CHECK-NOPIE-LD
270 // Try with the alias
271 // RUN: %clang %s -target i386-pc-openbsd -no-pie -### 2>&1 \
272 // RUN: | FileCheck %s --check-prefix=CHECK-NOPIE-LD
274 // On Android PIC is enabled by default, and PIE is enabled by default starting
275 // with API16.
276 // RUN: %clang -c %s -target i686-linux-android24 -### 2>&1 \
277 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
279 // RUN: %clang -c %s -target arm-linux-androideabi24 -### 2>&1 \
280 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
282 // 64-bit Android targets are always PIE.
283 // RUN: %clang -c %s -target aarch64-linux-android -### 2>&1 \
284 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
285 // RUN: %clang -c %s -target aarch64-linux-android24 -### 2>&1 \
286 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
287 // RUN: %clang -c %s -target arm64-linux-android -### 2>&1 \
288 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
290 // Default value of PIE can be overwritten, even on 64-bit targets.
291 // RUN: %clang -c %s -target arm-linux-androideabi -fPIE -### 2>&1 \
292 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
293 // RUN: %clang -c %s -target aarch64-linux-android -fno-PIE -### 2>&1 \
294 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
295 // RUN: %clang -c %s -target aarch64-linux-android24 -fno-PIE -### 2>&1 \
296 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
298 // On Windows x86_64 and aarch64 PIC is enabled by default
299 // RUN: %clang -c %s -target x86_64-pc-windows-msvc18.0.0 -### 2>&1 \
300 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
301 // RUN: %clang -c %s -target x86_64-pc-windows-gnu -### 2>&1 \
302 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
303 // RUN: %clang -c %s -target aarch64-windows-msvc -### 2>&1 \
304 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
305 // RUN: %clang -c %s -target aarch64-windows-gnu -### 2>&1 \
306 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
308 // On MinGW, allow specifying -fPIC & friends but ignore them
309 // RUN: %clang -fno-PIC -c %s -target x86_64-pc-windows-gnu -### 2>&1 \
310 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
311 // RUN: %clang -fPIC -c %s -target i686-pc-windows-gnu -### 2>&1 \
312 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
313 // RUN: %clang -fno-PIC -c %s -target aarch64-pc-windows-gnu -### 2>&1 \
314 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
315 // RUN: %clang -fPIC -c %s -target armv7-pc-windows-gnu -### 2>&1 \
316 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
318 // RUN: %clang -fpic -c --target=s390x-linux-gnu -mno-pic-data-is-text-relative %s \
319 // RUN: -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIC-DATA-TEXT-REL
320 // RUN: %clang -fpic -c --target=s390x-linux-gnu -mpic-data-is-text-relative %s -### \
321 // RUN: 2>&1 | FileCheck %s --check-prefix=CHECK-PIC-DATA-TEXT-REL
322 // RUN: not %clang -fpic -c --target=arm-arm-none-eabi -mno-pic-data-is-text-relative %s \
323 // RUN: -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIC-DATA-TEXT-REL-NON-SYSTEMZ
324 // RUN: not %clang -fpic -c --target=arm-arm-none-eabi -mpic-data-is-text-relative %s \
325 // RUN: -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIC-DATA-TEXT-REL-NON-SYSTEMZ
327 // On Haiku, PIC is enabled by default, and PIE is disabled by default.
328 // RUN: %clang -c %s --target=x86_64-unknown-haiku -### 2>&1 \
329 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
330 // RUN: %clang -c %s --target=i586-pc-haiku -### 2>&1 \
331 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2