summaryrefslogtreecommitdiff
path: root/flang/test/Driver/pic-flags.f90
blob: fb6ab701c3820a286a12ea76c47011809bac4696 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
! REQUIRES: aarch64-registered-target && x86-registered-target && arm-registered-target
! 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

! 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
! 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
! 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

! 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
! 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

! RUN: %flang -v -### -o - %s --target=i386-apple-darwin -mdynamic-no-pic 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-DYNAMIC-NO-PIC-32
! 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

! RUN: %flang -v -### -o - %s --target=arm-none-eabi -fropi 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-ROPI
! RUN: %flang -v -### -o - %s --target=arm-none-eabi -frwpi 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-RWPI
! RUN: %flang -v -### -o - %s --target=arm-none-eabi -fropi -frwpi 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-ROPI-RWPI

! CHECK: -fc1


!! -fno-pie.
! CHECK-STATIC: -mrelocation-model static
! CHECK-STATIC-NOT: -pic

! CHECK-STATIC-IR-NOT: {{PIE|PIC}} Level


!! -fpic.
! CHECK-PIC-LEVEL1: -mrelocation-model pic -pic-level 1
! CHECK-PIC-LEVEL1-NOT: -pic-is-pie

! CHECK-PIC-LEVEL1-IR-NOT: "PIE Level"
! CHECK-PIC-LEVEL1-IR: !"PIC Level", i32 1}
! CHECK-PIC-LEVEL1-IR-NOT: "PIE Level"


!! -fPIC.
! CHECK-PIC-LEVEL2: -mrelocation-model pic -pic-level 2
! CHECK-PIC-LEVEL2-NOT: -pic-is-pie

! CHECK-PIC-LEVEL2-IR-NOT: "PIE Level"
! CHECK-PIC-LEVEL2-IR: !"PIC Level", i32 2}
! CHECK-PIC-LEVEL2-IR-NOT: "PIE Level"


!! -fpie.
! CHECK-PIE-LEVEL1: -mrelocation-model pic -pic-level 1 -pic-is-pie
! CHECK-PIE-LEVEL1-IR: !"PIC Level", i32 1}
! CHECK-PIE-LEVEL1-IR: !"PIE Level", i32 1}


!! -fPIE.
! CHECK-PIE-LEVEL2: -mrelocation-model pic -pic-level 2 -pic-is-pie
! CHECK-PIE-LEVEL2-IR: !"PIC Level", i32 2}
! CHECK-PIE-LEVEL2-IR: !"PIE Level", i32 2}


!! -mdynamic-no-pic
! CHECK-DYNAMIC-NO-PIC-32: "-mrelocation-model" "dynamic-no-pic"
! CHECK-DYNAMIC-NO-PIC-32-NOT: "-pic-level"
! CHECK-DYNAMIC-NO-PIC-32-NOT: "-pic-is-pie"

! CHECK-DYNAMIC-NO-PIC-64: "-mrelocation-model" "dynamic-no-pic" "-pic-level" "2"
! CHECK-DYNAMIC-NO-PIC-64-NOT: "-pic-is-pie"


!! -fropi -frwpi
! CHECK-ROPI: "-mrelocation-model" "ropi"
! CHECK-ROPI-NOT: "-pic

! CHECK-RWPI: "-mrelocation-model" "rwpi"
! CHECK-RWPI-NOT: "-pic

! CHECK-ROPI-RWPI: "-mrelocation-model" "ropi-rwpi"
! CHECK-ROPI-RWPI-NOT: "-pic