Clang Project

clang_source_code/test/Driver/android-pie.c
1// NO-PIE-NOT: "-pie"
2// PIE: "-pie"
3
4// RUN: %clang %s -### -o %t.o 2>&1 --target=arm-linux-androideabi \
5// RUN:   | FileCheck --check-prefix=NO-PIE %s
6// RUN: %clang %s -### -o %t.o 2>&1 --target=arm-linux-android \
7// RUN:   | FileCheck --check-prefix=NO-PIE %s
8// RUN: %clang %s -### -o %t.o 2>&1 --target=arm-linux-android14 \
9// RUN:   | FileCheck --check-prefix=NO-PIE %s
10// RUN: %clang %s -### -o %t.o 2>&1 --target=arm-linux-android16 \
11// RUN:   | FileCheck --check-prefix=PIE %s
12// RUN: %clang %s -### -o %t.o 2>&1 --target=arm-linux-android24 \
13// RUN:   | FileCheck --check-prefix=PIE %s
14
15// RUN: %clang %s -### -o %t.o 2>&1 --target=mipsel-linux-android \
16// RUN:   | FileCheck --check-prefix=NO-PIE %s
17// RUN: %clang %s -### -o %t.o 2>&1 --target=mipsel-linux-android14 \
18// RUN:   | FileCheck --check-prefix=NO-PIE %s
19// RUN: %clang %s -### -o %t.o 2>&1 --target=mipsel-linux-android16 \
20// RUN:   | FileCheck --check-prefix=PIE %s
21// RUN: %clang %s -### -o %t.o 2>&1 --target=mipsel-linux-android24 \
22// RUN:   | FileCheck --check-prefix=PIE %s
23
24// RUN: %clang %s -### -o %t.o 2>&1 --target=i686-linux-android \
25// RUN:   | FileCheck --check-prefix=NO-PIE %s
26// RUN: %clang %s -### -o %t.o 2>&1 --target=i686-linux-android14 \
27// RUN:   | FileCheck --check-prefix=NO-PIE %s
28// RUN: %clang %s -### -o %t.o 2>&1 --target=i686-linux-android16 \
29// RUN:   | FileCheck --check-prefix=PIE %s
30// RUN: %clang %s -### -o %t.o 2>&1 --target=i686-linux-android24 \
31// RUN:   | FileCheck --check-prefix=PIE %s
32
33// RUN: %clang %s -### -o %t.o 2>&1 --target=aarch64-linux-android \
34// RUN:   | FileCheck --check-prefix=PIE %s
35// RUN: %clang %s -### -o %t.o 2>&1 --target=aarch64-linux-android24 \
36// RUN:   | FileCheck --check-prefix=PIE %s
37
38// RUN: %clang %s -### -o %t.o 2>&1 --target=arm64-linux-android \
39// RUN:   | FileCheck --check-prefix=PIE %s
40// RUN: %clang %s -### -o %t.o 2>&1 --target=arm64-linux-android24 \
41// RUN:   | FileCheck --check-prefix=PIE %s
42
43// RUN: %clang %s -### -o %t.o 2>&1 --target=mips64el-linux-android \
44// RUN:   | FileCheck --check-prefix=PIE %s
45// RUN: %clang %s -### -o %t.o 2>&1 --target=mips64el-linux-android24 \
46// RUN:   | FileCheck --check-prefix=PIE %s
47
48// RUN: %clang %s -### -o %t.o 2>&1 --target=x86_64-linux-android \
49// RUN:   | FileCheck --check-prefix=PIE %s
50// RUN: %clang %s -### -o %t.o 2>&1 --target=x86_64-linux-android24 \
51// RUN:   | FileCheck --check-prefix=PIE %s
52
53// Override toolchain default setting.
54// RUN: %clang %s -### -o %t.o 2>&1 -pie --target=arm-linux-androideabi \
55// RUN:   | FileCheck --check-prefix=PIE %s
56// RUN: %clang %s -### -o %t.o 2>&1 -pie --target=arm-linux-androideabi14 \
57// RUN:   | FileCheck --check-prefix=PIE %s
58// RUN: %clang %s -### -o %t.o 2>&1 -no-pie -pie --target=arm-linux-androideabi24 \
59// RUN:   | FileCheck --check-prefix=PIE %s
60
61// RUN: %clang %s -### -o %t.o 2>&1 -no-pie --target=arm-linux-androideabi24 \
62// RUN:   | FileCheck --check-prefix=NO-PIE %s
63// RUN: %clang %s -### -o %t.o 2>&1 -nopie --target=arm-linux-androideabi24 \
64// RUN:   | FileCheck --check-prefix=NO-PIE %s
65// RUN: %clang %s -### -o %t.o 2>&1 -pie -no-pie --target=arm-linux-androideabi24 \
66// RUN:   | FileCheck --check-prefix=NO-PIE %s
67
68// Static/shared/relocatable disable -pie
69
70// RUN: %clang %s -### --target=aarch64-linux-android -static 2>&1 \
71// RUN:     | FileCheck %s -check-prefix=CHECK-STATIC
72// CHECK-STATIC-NOT: "-pie"
73// CHECK-STATIC: -static
74
75// RUN: %clang %s -### --target=aarch64-linux-android -shared 2>&1 \
76// RUN:     | FileCheck %s -check-prefix=CHECK-SHARED
77// CHECK-SHARED-NOT: "-pie"
78// CHECK-SHARED: "-shared"
79
80// RUN: %clang %s -### --target=aarch64-linux-android -r 2>&1 \
81// RUN:     | FileCheck %s -check-prefix=CHECK-RELOCATABLE
82// CHECK-RELOCATABLE-NOT: "-pie"
83// CHECK-RELOCATABLE: "-r"
84