• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // REQUIRES: x86-registered-target
2 
3 // Test the driver's control over the PIC behavior for PS4 compiler.
4 // These consist of tests of the relocation model flags and the
5 // pic level flags passed to CC1.
6 //
7 // CHECK-NO-PIC: "-mrelocation-model" "static"
8 // CHECK-NO-PIC-NOT: "-pic-level"
9 // CHECK-NO-PIC-NOT: "-pie-level"
10 //
11 // CHECK-DYNAMIC-NO-PIC2: unsupported option '-mdynamic-no-pic'
12 // CHECK-DYNAMIC-NO-PIC2: "-mrelocation-model" "dynamic-no-pic"
13 //
14 // CHECK-PIC2: "-mrelocation-model" "pic"
15 // CHECK-PIC2: "-pic-level" "2"
16 //
17 // CHECK-PIE2: "-mrelocation-model" "pic"
18 // CHECK-PIE2: "-pie-level" "2"
19 //
20 // CHECK-NOPIC-IGNORED: using '-fPIC'
21 // CHECK-NOPIC-IGNORED: "-mrelocation-model" "pic"
22 // CHECK-NOPIC-IGNORED: "-pic-level" "2"
23 //
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'
26 // CHECK-DIAG-pic: option '-fno-pic' was ignored by the PS4 toolchain, using '-fPIC'
27 // CHECK-DIAG-pie: option '-fno-pie' was ignored by the PS4 toolchain, using '-fPIC'
28 //
29 // CHECK-STATIC-ERR: unsupported option '-static' for target 'PS4'
30 
31 // RUN: %clang -c %s -target x86_64-scei-ps4 -### 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 -fPIC -### 2>&1 \
36 // RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
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 -fPIE -### 2>&1 \
40 // RUN:   | FileCheck %s --check-prefix=CHECK-PIE2
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 -fPIC -fno-pic -### 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-pie -### 2>&1 \
56 // RUN:   | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
57 // RUN: %clang -c %s -target x86_64-scei-ps4 -fpie -fno-pic -### 2>&1 \
58 // RUN:   | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
59 // RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -fno-pie -### 2>&1 \
60 // RUN:   | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
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 -fpic -### 2>&1 \
64 // RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
65 // RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -fPIE -fpie -### 2>&1 \
66 // RUN:   | FileCheck %s --check-prefix=CHECK-PIE2
67 // RUN: %clang -c %s -target x86_64-scei-ps4 -fpie -fPIC -fPIE -### 2>&1 \
68 // RUN:   | FileCheck %s --check-prefix=CHECK-PIE2
69 //
70 // Defaults change for PS4.
71 // RUN: %clang -c %s -target x86_64-scei-ps4 -### 2>&1 \
72 // RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
73 // RUN: %clang -c %s -target x86_64-scei-ps4 -fno-pic -### 2>&1 \
74 // RUN:   | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
75 // RUN: %clang -c %s -target x86_64-scei-ps4 -fno-PIC -### 2>&1 \
76 // RUN:   | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
77 //
78 // Disregard any of the PIC-specific flags if we have a trump-card flag.
79 // RUN: %clang -c %s -target x86_64-scei-ps4 -mkernel -fPIC -### 2>&1 \
80 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
81 // RUN: %clang -c %s -target x86_64-scei-ps4 -mdynamic-no-pic -fPIC -### 2>&1 \
82 // RUN:   | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC2
83 //
84 // -static not supported at all.
85 // RUN: %clang -c %s -target x86_64-scei-ps4 -static -### 2>&1 \
86 // RUN:   | FileCheck %s --check-prefix=CHECK-STATIC-ERR
87 //
88 // -fno-PIC etc. is obeyed if -mcmodel=kernel is also present.
89 // RUN: %clang -c %s -target x86_64-scei-ps4 -mcmodel=kernel -fno-PIC -### 2>&1 \
90 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
91 // RUN: %clang -c %s -target x86_64-scei-ps4 -mcmodel=kernel -fno-PIE -### 2>&1 \
92 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
93 // RUN: %clang -c %s -target x86_64-scei-ps4 -mcmodel=kernel -fno-pic -### 2>&1 \
94 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
95 // RUN: %clang -c %s -target x86_64-scei-ps4 -mcmodel=kernel -fno-pie -### 2>&1 \
96 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
97 //
98 // Verify that we reflect the option the user specified, when we ignore it.
99 // RUN: %clang -c %s -target x86_64-scei-ps4 -fno-PIC -### 2>&1 \
100 // RUN:   | FileCheck %s --check-prefix=CHECK-DIAG-PIC
101 // RUN: %clang -c %s -target x86_64-scei-ps4 -fno-PIE -### 2>&1 \
102 // RUN:   | FileCheck %s --check-prefix=CHECK-DIAG-PIE
103 // RUN: %clang -c %s -target x86_64-scei-ps4 -fno-pic -### 2>&1 \
104 // RUN:   | FileCheck %s --check-prefix=CHECK-DIAG-pic
105 // RUN: %clang -c %s -target x86_64-scei-ps4 -fno-pie -### 2>&1 \
106 // RUN:   | FileCheck %s --check-prefix=CHECK-DIAG-pie
107