1 // Test the driver's control over the PIC behavior for PS4 compiler.
2 // These consist of tests of the relocation model flags and the
3 // pic level flags passed to CC1.
5 // CHECK-NO-PIC: "-mrelocation-model" "static"
6 // CHECK-NO-PIC-NOT: "-pic-level"
7 // CHECK-NO-PIC-NOT: "-pic-is-pie"
9 // CHECK-DYNAMIC-NO-PIC2: unsupported option '-mdynamic-no-pic'
10 // CHECK-DYNAMIC-NO-PIC2: "-mrelocation-model" "dynamic-no-pic"
12 // CHECK-PIC2: "-mrelocation-model" "pic"
13 // CHECK-PIC2: "-pic-level" "2"
15 // CHECK-PIE2: "-mrelocation-model" "pic"
16 // CHECK-PIE2: "-pic-is-pie"
18 // CHECK-NOPIC-IGNORED: using '-fPIC'
19 // CHECK-NOPIC-IGNORED: "-mrelocation-model" "pic"
20 // CHECK-NOPIC-IGNORED: "-pic-level" "2"
22 // CHECK-DIAG-PIC: option '-fno-PIC' was ignored by the PS4 toolchain, using '-fPIC'
23 // CHECK-DIAG-PIE: option '-fno-PIE' was ignored by the PS4 toolchain, using '-fPIC'
24 // CHECK-DIAG-pic: option '-fno-pic' was ignored by the PS4 toolchain, using '-fPIC'
25 // CHECK-DIAG-pie: option '-fno-pie' was ignored by the PS4 toolchain, using '-fPIC'
27 // CHECK-STATIC-ERR: unsupported option '-static' for target 'PS4'
29 // RUN: %clang -c %s -target x86_64-scei-ps4 -### 2>&1 \
30 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
31 // RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -### 2>&1 \
32 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
33 // RUN: %clang -c %s -target x86_64-scei-ps4 -fPIC -### 2>&1 \
34 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
35 // RUN: %clang -c %s -target x86_64-scei-ps4 -fpie -### 2>&1 \
36 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
37 // RUN: %clang -c %s -target x86_64-scei-ps4 -fPIE -### 2>&1 \
38 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
39 // RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -fno-pic -### 2>&1 \
40 // RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
41 // RUN: %clang -c %s -target x86_64-scei-ps4 -fPIC -fno-PIC -### 2>&1 \
42 // RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
43 // RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -fno-PIC -### 2>&1 \
44 // RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
45 // RUN: %clang -c %s -target x86_64-scei-ps4 -fPIC -fno-pic -### 2>&1 \
46 // RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
47 // RUN: %clang -c %s -target x86_64-scei-ps4 -fpie -fno-pie -### 2>&1 \
48 // RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
49 // RUN: %clang -c %s -target x86_64-scei-ps4 -fPIE -fno-PIE -### 2>&1 \
50 // RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
51 // RUN: %clang -c %s -target x86_64-scei-ps4 -fpie -fno-PIE -### 2>&1 \
52 // RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
53 // RUN: %clang -c %s -target x86_64-scei-ps4 -fPIE -fno-pie -### 2>&1 \
54 // RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
55 // RUN: %clang -c %s -target x86_64-scei-ps4 -fpie -fno-pic -### 2>&1 \
56 // RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
57 // RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -fno-pie -### 2>&1 \
58 // RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
59 // RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -fPIC -### 2>&1 \
60 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
61 // RUN: %clang -c %s -target x86_64-scei-ps4 -fPIC -fpic -### 2>&1 \
62 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
63 // RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -fPIE -fpie -### 2>&1 \
64 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
65 // RUN: %clang -c %s -target x86_64-scei-ps4 -fpie -fPIC -fPIE -### 2>&1 \
66 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2
68 // Defaults change for PS4.
69 // RUN: %clang -c %s -target x86_64-scei-ps4 -### 2>&1 \
70 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2
71 // RUN: %clang -c %s -target x86_64-scei-ps4 -fno-pic -### 2>&1 \
72 // RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
73 // RUN: %clang -c %s -target x86_64-scei-ps4 -fno-PIC -### 2>&1 \
74 // RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
76 // Disregard any of the PIC-specific flags if we have a trump-card flag.
77 // RUN: %clang -c %s -target x86_64-scei-ps4 -mkernel -fPIC -### 2>&1 \
78 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
79 // RUN: not %clang -c %s --target=x86_64-scei-ps4 -mdynamic-no-pic -fPIC -### 2>&1 \
80 // RUN: | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC2
82 // -static not supported at all.
83 // RUN: not %clang -c %s --target=x86_64-scei-ps4 -static -### 2>&1 \
84 // RUN: | FileCheck %s --check-prefix=CHECK-STATIC-ERR
86 // -fno-PIC etc. is obeyed if -mcmodel=kernel is also present.
87 // RUN: %clang -c %s -target x86_64-scei-ps4 -mcmodel=kernel -fno-PIC -### 2>&1 \
88 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
89 // RUN: %clang -c %s -target x86_64-scei-ps4 -mcmodel=kernel -fno-PIE -### 2>&1 \
90 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
91 // RUN: %clang -c %s -target x86_64-scei-ps4 -mcmodel=kernel -fno-pic -### 2>&1 \
92 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
93 // RUN: %clang -c %s -target x86_64-scei-ps4 -mcmodel=kernel -fno-pie -### 2>&1 \
94 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
96 // Verify that we reflect the option the user specified, when we ignore it.
97 // RUN: %clang -c %s -target x86_64-scei-ps4 -fno-PIC -### 2>&1 \
98 // RUN: | FileCheck %s --check-prefix=CHECK-DIAG-PIC
99 // RUN: %clang -c %s -target x86_64-scei-ps4 -fno-PIE -### 2>&1 \
100 // RUN: | FileCheck %s --check-prefix=CHECK-DIAG-PIE
101 // RUN: %clang -c %s -target x86_64-scei-ps4 -fno-pic -### 2>&1 \
102 // RUN: | FileCheck %s --check-prefix=CHECK-DIAG-pic
103 // RUN: %clang -c %s -target x86_64-scei-ps4 -fno-pie -### 2>&1 \
104 // RUN: | FileCheck %s --check-prefix=CHECK-DIAG-pie