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. 4 // 5 // CHECK-NO-PIC: "-mrelocation-model" "static" 6 // CHECK-NO-PIC-NOT: "-pic-level" 7 // CHECK-NO-PIC-NOT: "-pic-is-pie" 8 // 9 // CHECK-DYNAMIC-NO-PIC2: unsupported option '-mdynamic-no-pic' 10 // CHECK-DYNAMIC-NO-PIC2: "-mrelocation-model" "dynamic-no-pic" 11 // 12 // CHECK-PIC2: "-mrelocation-model" "pic" 13 // CHECK-PIC2: "-pic-level" "2" 14 // 15 // CHECK-PIE2: "-mrelocation-model" "pic" 16 // CHECK-PIE2: "-pic-is-pie" 17 // 18 // CHECK-NOPIC-IGNORED: using '-fPIC' 19 // CHECK-NOPIC-IGNORED: "-mrelocation-model" "pic" 20 // CHECK-NOPIC-IGNORED: "-pic-level" "2" 21 // 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' 26 27 // RUN: %clang -c %s -target x86_64-scei-ps4 -### 2>&1 \ 28 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2 29 // RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -### 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 -fpie -### 2>&1 \ 34 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2 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 -fpic -fno-pic -### 2>&1 \ 38 // RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED 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 -fpie -fno-pie -### 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-pic -### 2>&1 \ 54 // RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED 55 // RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -fno-pie -### 2>&1 \ 56 // RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED 57 // RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -fPIC -### 2>&1 \ 58 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2 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 -fPIE -fpie -### 2>&1 \ 62 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2 63 // RUN: %clang -c %s -target x86_64-scei-ps4 -fpie -fPIC -fPIE -### 2>&1 \ 64 // RUN: | FileCheck %s --check-prefix=CHECK-PIE2 65 // 66 // Defaults change for PS4. 67 // RUN: %clang -c %s -target x86_64-scei-ps4 -### 2>&1 \ 68 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2 69 // RUN: %clang -c %s -target x86_64-scei-ps4 -fno-pic -### 2>&1 \ 70 // RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED 71 // RUN: %clang -c %s -target x86_64-scei-ps4 -fno-PIC -### 2>&1 \ 72 // RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED 73 // 74 // Disregard any of the PIC-specific flags if we have a trump-card flag. 75 // RUN: %clang -c %s -target x86_64-scei-ps4 -mkernel -fPIC -### 2>&1 \ 76 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC 77 // RUN: not %clang -c %s --target=x86_64-scei-ps4 -mdynamic-no-pic -fPIC -### 2>&1 \ 78 // RUN: | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC2 79 // 80 // The -static argument *doesn't* override PIC: -static only affects 81 // linking, and -fPIC only affects code generation. 82 // RUN: %clang -c %s -target x86_64-scei-ps4 -static -fPIC -### 2>&1 \ 83 // RUN: | FileCheck %s --check-prefix=CHECK-PIC2 84 // 85 // -fno-PIC etc. is obeyed if -mcmodel=kernel is also present. 86 // RUN: %clang -c %s -target x86_64-scei-ps4 -mcmodel=kernel -fno-PIC -### 2>&1 \ 87 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC 88 // RUN: %clang -c %s -target x86_64-scei-ps4 -mcmodel=kernel -fno-PIE -### 2>&1 \ 89 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC 90 // RUN: %clang -c %s -target x86_64-scei-ps4 -mcmodel=kernel -fno-pic -### 2>&1 \ 91 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC 92 // RUN: %clang -c %s -target x86_64-scei-ps4 -mcmodel=kernel -fno-pie -### 2>&1 \ 93 // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC 94 // 95 // Verify that we reflect the option the user specified, when we ignore it. 96 // RUN: %clang -c %s -target x86_64-scei-ps4 -fno-PIC -### 2>&1 \ 97 // RUN: | FileCheck %s --check-prefix=CHECK-DIAG-PIC 98 // RUN: %clang -c %s -target x86_64-scei-ps4 -fno-PIE -### 2>&1 \ 99 // RUN: | FileCheck %s --check-prefix=CHECK-DIAG-PIE 100 // RUN: %clang -c %s -target x86_64-scei-ps4 -fno-pic -### 2>&1 \ 101 // RUN: | FileCheck %s --check-prefix=CHECK-DIAG-pic 102 // RUN: %clang -c %s -target x86_64-scei-ps4 -fno-pie -### 2>&1 \ 103 // RUN: | FileCheck %s --check-prefix=CHECK-DIAG-pie 104