Home | History | Annotate | Download | only in Driver
      1 // Test the driver's control over the PIC behavior. These consist of tests of
      2 // 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: "-pie-level"
      7 //
      8 // CHECK-DYNAMIC-NO-PIC1: "-mrelocation-model" "dynamic-no-pic"
      9 // CHECK-DYNAMIC-NO-PIC1: "-pic-level" "1"
     10 //
     11 // CHECK-DYNAMIC-NO-PIC2: "-mrelocation-model" "dynamic-no-pic"
     12 // CHECK-DYNAMIC-NO-PIC2: "-pic-level" "2"
     13 //
     14 // CHECK-PIC1-NOT: "-mrelocation-model"
     15 // CHECK-PIC1: "-pic-level" "1"
     16 //
     17 // CHECK-PIC2-NOT: "-mrelocation-model"
     18 // CHECK-PIC2: "-pic-level" "2"
     19 //
     20 // CHECK-PIE1-NOT: "-mrelocation-model"
     21 // CHECK-PIE1: "-pie-level" "1"
     22 //
     23 // CHECK-PIE2-NOT: "-mrelocation-model"
     24 // CHECK-PIE2: "-pie-level" "2"
     25 //
     26 // RUN: %clang -c %s -target i386-unknown-unknown -### 2>&1 \
     27 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
     28 // RUN: %clang -c %s -target i386-unknown-unknown -fpic -### 2>&1 \
     29 // RUN:   | FileCheck %s --check-prefix=CHECK-PIC1
     30 // RUN: %clang -c %s -target i386-unknown-unknown -fPIC -### 2>&1 \
     31 // RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
     32 // RUN: %clang -c %s -target i386-unknown-unknown -fpie -### 2>&1 \
     33 // RUN:   | FileCheck %s --check-prefix=CHECK-PIE1
     34 // RUN: %clang -c %s -target i386-unknown-unknown -fPIE -### 2>&1 \
     35 // RUN:   | FileCheck %s --check-prefix=CHECK-PIE2
     36 // RUN: %clang -c %s -target i386-unknown-unknown -fpic -fno-pic -### 2>&1 \
     37 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
     38 // RUN: %clang -c %s -target i386-unknown-unknown -fPIC -fno-PIC -### 2>&1 \
     39 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
     40 // RUN: %clang -c %s -target i386-unknown-unknown -fpic -fno-PIC -### 2>&1 \
     41 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
     42 // RUN: %clang -c %s -target i386-unknown-unknown -fPIC -fno-pic -### 2>&1 \
     43 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
     44 // RUN: %clang -c %s -target i386-unknown-unknown -fpie -fno-pie -### 2>&1 \
     45 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
     46 // RUN: %clang -c %s -target i386-unknown-unknown -fPIE -fno-PIE -### 2>&1 \
     47 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
     48 // RUN: %clang -c %s -target i386-unknown-unknown -fpie -fno-PIE -### 2>&1 \
     49 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
     50 // RUN: %clang -c %s -target i386-unknown-unknown -fPIE -fno-pie -### 2>&1 \
     51 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
     52 // RUN: %clang -c %s -target i386-unknown-unknown -fpie -fno-pic -### 2>&1 \
     53 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
     54 // RUN: %clang -c %s -target i386-unknown-unknown -fpic -fno-pie -### 2>&1 \
     55 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
     56 // RUN: %clang -c %s -target i386-unknown-unknown -fpic -fPIC -### 2>&1 \
     57 // RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
     58 // RUN: %clang -c %s -target i386-unknown-unknown -fPIC -fpic -### 2>&1 \
     59 // RUN:   | FileCheck %s --check-prefix=CHECK-PIC1
     60 // RUN: %clang -c %s -target i386-unknown-unknown -fpic -fPIE -fpie -### 2>&1 \
     61 // RUN:   | FileCheck %s --check-prefix=CHECK-PIE1
     62 // RUN: %clang -c %s -target i386-unknown-unknown -fpie -fPIC -fPIE -### 2>&1 \
     63 // RUN:   | FileCheck %s --check-prefix=CHECK-PIE2
     64 //
     65 // Defaults change for Darwin.
     66 // RUN: %clang -c %s -target i386-apple-darwin -### 2>&1 \
     67 // RUN:   | FileCheck %s --check-prefix=CHECK-PIC2
     68 // RUN: %clang -c %s -target i386-apple-darwin -fno-pic -### 2>&1 \
     69 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
     70 // RUN: %clang -c %s -target i386-apple-darwin -fno-PIC -### 2>&1 \
     71 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
     72 //
     73 // Disregard any of the PIC-specific flags if we have a trump-card flag.
     74 // RUN: %clang -c %s -target i386-unknown-unknown -mkernel -fPIC -### 2>&1 \
     75 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
     76 // RUN: %clang -c %s -target i386-unknown-unknown -static -fPIC -### 2>&1 \
     77 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIC
     78 // RUN: %clang -c %s -target i386-unknown-unknown -mdynamic-no-pic -fPIC -### 2>&1 \
     79 // RUN:   | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC1
     80 // RUN: %clang -c %s -target i386-apple-darwin -mdynamic-no-pic -fPIC -### 2>&1 \
     81 // RUN:   | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC2
     82