1 ! REQUIRES: aarch64-registered-target && x86-registered-target && arm-registered-target
2 ! RUN: %flang -v -S -emit-llvm -o - %s --target=aarch64-linux-gnu -fno-pie 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-STATIC,CHECK-STATIC-IR
4 ! RUN: %flang -v -S -emit-llvm -o - %s --target=aarch64-linux-gnu 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-PIE-LEVEL2,CHECK-PIE-LEVEL2-IR
5 ! RUN: %flang -v -S -emit-llvm -o - %s --target=aarch64-linux-gnu -fpie 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-PIE-LEVEL1,CHECK-PIE-LEVEL1-IR
6 ! RUN: %flang -v -S -emit-llvm -o - %s --target=aarch64-linux-gnu -fPIE 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-PIE-LEVEL2,CHECK-PIE-LEVEL2-IR
8 ! RUN: %flang -v -S -emit-llvm -o - %s --target=aarch64-linux-gnu -fpic 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-PIC-LEVEL1,CHECK-PIC-LEVEL1-IR
9 ! RUN: %flang -v -S -emit-llvm -o - %s --target=aarch64-linux-gnu -fPIC 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-PIC-LEVEL2,CHECK-PIC-LEVEL2-IR
11 ! RUN: %flang -v -### -o - %s --target=i386-apple-darwin -mdynamic-no-pic 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-DYNAMIC-NO-PIC-32
12 ! RUN: %flang -v -### -o - %s --target=x86_64-apple-darwin -mdynamic-no-pic 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-DYNAMIC-NO-PIC-64
14 ! RUN: %flang -v -### -o - %s --target=arm-none-eabi -fropi 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-ROPI
15 ! RUN: %flang -v -### -o - %s --target=arm-none-eabi -frwpi 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-RWPI
16 ! RUN: %flang -v -### -o - %s --target=arm-none-eabi -fropi -frwpi 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-ROPI-RWPI
22 ! CHECK-STATIC: -mrelocation-model static
23 ! CHECK-STATIC-NOT: -pic
25 ! CHECK-STATIC-IR-NOT: {{PIE|PIC}} Level
29 ! CHECK-PIC-LEVEL1: -mrelocation-model pic -pic-level 1
30 ! CHECK-PIC-LEVEL1-NOT: -pic-is-pie
32 ! CHECK-PIC-LEVEL1-IR-NOT: "PIE Level"
33 ! CHECK-PIC-LEVEL1-IR: !"PIC Level", i32 1}
34 ! CHECK-PIC-LEVEL1-IR-NOT: "PIE Level"
38 ! CHECK-PIC-LEVEL2: -mrelocation-model pic -pic-level 2
39 ! CHECK-PIC-LEVEL2-NOT: -pic-is-pie
41 ! CHECK-PIC-LEVEL2-IR-NOT: "PIE Level"
42 ! CHECK-PIC-LEVEL2-IR: !"PIC Level", i32 2}
43 ! CHECK-PIC-LEVEL2-IR-NOT: "PIE Level"
47 ! CHECK-PIE-LEVEL1: -mrelocation-model pic -pic-level 1 -pic-is-pie
48 ! CHECK-PIE-LEVEL1-IR: !"PIC Level", i32 1}
49 ! CHECK-PIE-LEVEL1-IR: !"PIE Level", i32 1}
53 ! CHECK-PIE-LEVEL2: -mrelocation-model pic -pic-level 2 -pic-is-pie
54 ! CHECK-PIE-LEVEL2-IR: !"PIC Level", i32 2}
55 ! CHECK-PIE-LEVEL2-IR: !"PIE Level", i32 2}
59 ! CHECK-DYNAMIC-NO-PIC-32: "-mrelocation-model" "dynamic-no-pic"
60 ! CHECK-DYNAMIC-NO-PIC-32-NOT: "-pic-level"
61 ! CHECK-DYNAMIC-NO-PIC-32-NOT: "-pic-is-pie"
63 ! CHECK-DYNAMIC-NO-PIC-64: "-mrelocation-model" "dynamic-no-pic" "-pic-level" "2"
64 ! CHECK-DYNAMIC-NO-PIC-64-NOT: "-pic-is-pie"
68 ! CHECK-ROPI: "-mrelocation-model" "ropi"
69 ! CHECK-ROPI-NOT: "-pic
71 ! CHECK-RWPI: "-mrelocation-model" "rwpi"
72 ! CHECK-RWPI-NOT: "-pic
74 ! CHECK-ROPI-RWPI: "-mrelocation-model" "ropi-rwpi"
75 ! CHECK-ROPI-RWPI-NOT: "-pic