xref: /llvm-project/clang/test/Driver/android-pie.c (revision cac82e26c642d55672b1de6f3d026826c89994ec)
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=PIE %s
6 // RUN: %clang %s -### -o %t.o 2>&1 --target=arm-linux-android \
7 // RUN:   | FileCheck --check-prefix=PIE %s
8 // RUN: %clang %s -### -o %t.o 2>&1 --target=arm-linux-android24 \
9 // RUN:   | FileCheck --check-prefix=PIE %s
10 
11 // RUN: %clang %s -### -o %t.o 2>&1 --target=i686-linux-android \
12 // RUN:   | FileCheck --check-prefix=PIE %s
13 // RUN: %clang %s -### -o %t.o 2>&1 --target=i686-linux-android24 \
14 // RUN:   | FileCheck --check-prefix=PIE %s
15 
16 // RUN: %clang %s -### -o %t.o 2>&1 --target=aarch64-linux-android \
17 // RUN:   | FileCheck --check-prefix=PIE %s
18 // RUN: %clang %s -### -o %t.o 2>&1 --target=aarch64-linux-android24 \
19 // RUN:   | FileCheck --check-prefix=PIE %s
20 
21 // RUN: %clang %s -### -o %t.o 2>&1 --target=arm64-linux-android \
22 // RUN:   | FileCheck --check-prefix=PIE %s
23 // RUN: %clang %s -### -o %t.o 2>&1 --target=arm64-linux-android24 \
24 // RUN:   | FileCheck --check-prefix=PIE %s
25 
26 // RUN: %clang %s -### -o %t.o 2>&1 --target=x86_64-linux-android \
27 // RUN:   | FileCheck --check-prefix=PIE %s
28 // RUN: %clang %s -### -o %t.o 2>&1 --target=x86_64-linux-android24 \
29 // RUN:   | FileCheck --check-prefix=PIE %s
30 
31 // Override toolchain default setting.
32 // RUN: %clang %s -### -o %t.o 2>&1 -pie --target=arm-linux-androideabi \
33 // RUN:   | FileCheck --check-prefix=PIE %s
34 // RUN: %clang %s -### -o %t.o 2>&1 -no-pie -pie --target=arm-linux-androideabi24 \
35 // RUN:   | FileCheck --check-prefix=PIE %s
36 
37 // RUN: %clang %s -### -o %t.o 2>&1 -no-pie --target=arm-linux-androideabi24 \
38 // RUN:   | FileCheck --check-prefix=NO-PIE %s
39 // RUN: %clang %s -### -o %t.o 2>&1 -pie -no-pie --target=arm-linux-androideabi24 \
40 // RUN:   | FileCheck --check-prefix=NO-PIE %s
41 
42 // Static/shared/relocatable disable -pie
43 
44 // RUN: %clang %s -### --target=aarch64-linux-android -static 2>&1 \
45 // RUN:     | FileCheck %s -check-prefix=CHECK-STATIC
46 // CHECK-STATIC-NOT: "-pie"
47 // CHECK-STATIC: -static
48 
49 // RUN: %clang %s -### --target=aarch64-linux-android -shared 2>&1 \
50 // RUN:     | FileCheck %s -check-prefix=CHECK-SHARED
51 // CHECK-SHARED-NOT: "-pie"
52 // CHECK-SHARED: "-shared"
53 
54 // RUN: %clang %s -### --target=aarch64-linux-android -r 2>&1 \
55 // RUN:     | FileCheck %s -check-prefix=CHECK-RELOCATABLE
56 // CHECK-RELOCATABLE-NOT: "-pie"
57 // CHECK-RELOCATABLE: "-r"
58