1 // Check passing PowerPC ABI options to the backend.
2 
3 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
4 // RUN:   | FileCheck -check-prefix=CHECK-ELFv1 %s
5 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
6 // RUN:   -mabi=elfv1 | FileCheck -check-prefix=CHECK-ELFv1 %s
7 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
8 // RUN:   -mabi=elfv2 | FileCheck -check-prefix=CHECK-ELFv2-BE %s
9 
10 // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \
11 // RUN:   | FileCheck -check-prefix=CHECK-ELFv2 %s
12 // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \
13 // RUN:   -mabi=elfv1 | FileCheck -check-prefix=CHECK-ELFv1-LE %s
14 // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \
15 // RUN:   -mabi=elfv2 | FileCheck -check-prefix=CHECK-ELFv2 %s
16 // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \
17 // RUN:   -mabi=altivec | FileCheck -check-prefix=CHECK-ELFv2 %s
18 
19 // RUN: %clang -target powerpc64-unknown-freebsd11 %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv1 %s
20 // RUN: %clang -target powerpc64-unknown-freebsd12 %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv1 %s
21 // RUN: %clang -target powerpc64-unknown-freebsd13 %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv2-BE %s
22 // RUN: %clang -target powerpc64-unknown-freebsd14 %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv2-BE %s
23 // RUN: %clang -target powerpc64le-unknown-freebsd13 %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv2 %s
24 // RUN: %clang -target powerpc64-unknown-openbsd %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv2-BE-PIE %s
25 // RUN: %clang -target powerpc64-linux-musl %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv2-BE-PIE %s
26 
27 // CHECK-ELFv1: "-mrelocation-model" "static"
28 // CHECK-ELFv1: "-target-abi" "elfv1"
29 // CHECK-ELFv1-LE: "-mrelocation-model" "static"
30 // CHECK-ELFv1-LE: "-target-abi" "elfv1"
31 // CHECK-ELFv2: "-mrelocation-model" "static"
32 // CHECK-ELFv2: "-target-abi" "elfv2"
33 // CHECK-ELFv2-BE: "-mrelocation-model" "static"
34 // CHECK-ELFv2-BE: "-target-abi" "elfv2"
35 // CHECK-ELFv2-BE-PIE: "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie"
36 // CHECK-ELFv2-BE-PIE: "-target-abi" "elfv2"
37 
38 // RUN: %clang -fPIC -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
39 // RUN:   | FileCheck -check-prefix=CHECK-ELFv1-PIC %s
40 // RUN: %clang -fPIC -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
41 // RUN:   -mabi=elfv1 | FileCheck -check-prefix=CHECK-ELFv1-PIC %s
42 // RUN: %clang -fPIC -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
43 // RUN:   -mabi=elfv2 | FileCheck -check-prefix=CHECK-ELFv2-PIC %s
44 
45 // RUN: %clang -fPIC -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \
46 // RUN:   | FileCheck -check-prefix=CHECK-ELFv2-PIC %s
47 // RUN: %clang -fPIC -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \
48 // RUN:   -mabi=elfv1 | FileCheck -check-prefix=CHECK-ELFv1-PIC %s
49 // RUN: %clang -fPIC -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \
50 // RUN:   -mabi=elfv2 | FileCheck -check-prefix=CHECK-ELFv2-PIC %s
51 // RUN: %clang -fPIC -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \
52 // RUN:   -mabi=altivec | FileCheck -check-prefix=CHECK-ELFv2-PIC %s
53 
54 // CHECK-ELFv1-PIC: "-mrelocation-model" "pic" "-pic-level" "2"
55 // CHECK-ELFv1-PIC: "-target-abi" "elfv1"
56 // CHECK-ELFv2-PIC: "-mrelocation-model" "pic" "-pic-level" "2"
57 // CHECK-ELFv2-PIC: "-target-abi" "elfv2"
58 
59 // Check -mabi=ieeelongdouble is passed through but it does not change -target-abi.
60 // RUN: %clang -target powerpc64le-linux-gnu %s -mabi=ieeelongdouble -mabi=elfv1 -### 2>&1 \
61 // RUN:   | FileCheck -check-prefix=CHECK-ELFv1-IEEE %s
62 // RUN: %clang -target powerpc64le-linux-gnu %s -mabi=elfv1 -mabi=ieeelongdouble -### 2>&1 \
63 // RUN:   | FileCheck -check-prefix=CHECK-ELFv1-IEEE %s
64 // RUN: %clang -target powerpc64le-linux-gnu %s -mabi=elfv2 -mabi=elfv1 -mabi=ibmlongdouble -mabi=ieeelongdouble -### 2>&1 \
65 // RUN:   | FileCheck -check-prefix=CHECK-ELFv1-IEEE %s
66 
67 // CHECK-ELFv1-IEEE: "-mabi=ieeelongdouble"
68 // CHECK-ELFv1-IEEE: "-target-abi" "elfv1"
69 
70 // Check -mabi=ibmlongdouble is the default.
71 // RUN: %clang -target powerpc64le-linux-gnu %s -### 2>&1 \
72 // RUN:   | FileCheck -check-prefix=CHECK-ELFv2-IBM128 %s
73 // RUN: %clang -target powerpc64le-linux-gnu %s -mabi=ibmlongdouble -### 2>&1 \
74 // RUN:   | FileCheck -check-prefix=CHECK-ELFv2-IBM128 %s
75 
76 // CHECK-ELFv2-IBM128-NOT: "-mabi=ieeelongdouble"
77 // CHECK-ELFv2-IBM128: "-target-abi" "elfv2"
78