diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp --- a/clang/lib/Driver/ToolChains/Linux.cpp +++ b/clang/lib/Driver/ToolChains/Linux.cpp @@ -663,8 +663,8 @@ } bool Linux::isPIEDefault() const { - return (getTriple().isAndroid() && !getTriple().isAndroidVersionLT(16)) || - getTriple().isMusl() || getSanitizerArgs().requiresPIE(); + return getTriple().isAndroid() || getTriple().isMusl() || + getSanitizerArgs().requiresPIE(); } bool Linux::IsAArch64OutlineAtomicsDefault(const ArgList &Args) const { diff --git a/clang/test/Driver/android-pie.c b/clang/test/Driver/android-pie.c --- a/clang/test/Driver/android-pie.c +++ b/clang/test/Driver/android-pie.c @@ -2,30 +2,18 @@ // PIE: "-pie" // RUN: %clang %s -### -o %t.o 2>&1 --target=arm-linux-androideabi \ -// RUN: | FileCheck --check-prefix=NO-PIE %s +// RUN: | FileCheck --check-prefix=PIE %s // RUN: %clang %s -### -o %t.o 2>&1 --target=arm-linux-android \ -// RUN: | FileCheck --check-prefix=NO-PIE %s -// RUN: %clang %s -### -o %t.o 2>&1 --target=arm-linux-android14 \ -// RUN: | FileCheck --check-prefix=NO-PIE %s -// RUN: %clang %s -### -o %t.o 2>&1 --target=arm-linux-android16 \ // RUN: | FileCheck --check-prefix=PIE %s // RUN: %clang %s -### -o %t.o 2>&1 --target=arm-linux-android24 \ // RUN: | FileCheck --check-prefix=PIE %s // RUN: %clang %s -### -o %t.o 2>&1 --target=mipsel-linux-android \ -// RUN: | FileCheck --check-prefix=NO-PIE %s -// RUN: %clang %s -### -o %t.o 2>&1 --target=mipsel-linux-android14 \ -// RUN: | FileCheck --check-prefix=NO-PIE %s -// RUN: %clang %s -### -o %t.o 2>&1 --target=mipsel-linux-android16 \ // RUN: | FileCheck --check-prefix=PIE %s // RUN: %clang %s -### -o %t.o 2>&1 --target=mipsel-linux-android24 \ // RUN: | FileCheck --check-prefix=PIE %s // RUN: %clang %s -### -o %t.o 2>&1 --target=i686-linux-android \ -// RUN: | FileCheck --check-prefix=NO-PIE %s -// RUN: %clang %s -### -o %t.o 2>&1 --target=i686-linux-android14 \ -// RUN: | FileCheck --check-prefix=NO-PIE %s -// RUN: %clang %s -### -o %t.o 2>&1 --target=i686-linux-android16 \ // RUN: | FileCheck --check-prefix=PIE %s // RUN: %clang %s -### -o %t.o 2>&1 --target=i686-linux-android24 \ // RUN: | FileCheck --check-prefix=PIE %s @@ -53,8 +41,6 @@ // Override toolchain default setting. // RUN: %clang %s -### -o %t.o 2>&1 -pie --target=arm-linux-androideabi \ // RUN: | FileCheck --check-prefix=PIE %s -// RUN: %clang %s -### -o %t.o 2>&1 -pie --target=arm-linux-androideabi14 \ -// RUN: | FileCheck --check-prefix=PIE %s // RUN: %clang %s -### -o %t.o 2>&1 -no-pie -pie --target=arm-linux-androideabi24 \ // RUN: | FileCheck --check-prefix=PIE %s diff --git a/clang/test/Driver/fsanitize.c b/clang/test/Driver/fsanitize.c --- a/clang/test/Driver/fsanitize.c +++ b/clang/test/Driver/fsanitize.c @@ -348,7 +348,7 @@ // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE // RUN: %clang -target x86_64-unknown-freebsd -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE // RUN: %clang -target aarch64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE -// RUN: %clang -target arm-linux-androideabi -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIC-NO-PIE +// RUN: %clang -target arm-linux-androideabi -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE // RUN: %clang -target arm-linux-androideabi24 -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE // RUN: %clang -target aarch64-linux-android -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE // RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE diff --git a/clang/test/Driver/pic.c b/clang/test/Driver/pic.c --- a/clang/test/Driver/pic.c +++ b/clang/test/Driver/pic.c @@ -267,30 +267,12 @@ // // On Android PIC is enabled by default, and PIE is enabled by default starting // with API16. -// RUN: %clang -c %s -target i686-linux-android -### 2>&1 \ -// RUN: | FileCheck %s --check-prefix=CHECK-PIC2 -// RUN: %clang -c %s -target i686-linux-android14 -### 2>&1 \ -// RUN: | FileCheck %s --check-prefix=CHECK-PIC2 -// RUN: %clang -c %s -target i686-linux-android16 -### 2>&1 \ -// RUN: | FileCheck %s --check-prefix=CHECK-PIE2 // RUN: %clang -c %s -target i686-linux-android24 -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-PIE2 // -// RUN: %clang -c %s -target arm-linux-androideabi -### 2>&1 \ -// RUN: | FileCheck %s --check-prefix=CHECK-PIC1 -// RUN: %clang -c %s -target arm-linux-androideabi14 -### 2>&1 \ -// RUN: | FileCheck %s --check-prefix=CHECK-PIC1 -// RUN: %clang -c %s -target arm-linux-androideabi16 -### 2>&1 \ -// RUN: | FileCheck %s --check-prefix=CHECK-PIE2 // RUN: %clang -c %s -target arm-linux-androideabi24 -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-PIE2 // -// RUN: %clang -c %s -target mipsel-linux-android -### 2>&1 \ -// RUN: | FileCheck %s --check-prefix=CHECK-PIC1 -// RUN: %clang -c %s -target mipsel-linux-android14 -### 2>&1 \ -// RUN: | FileCheck %s --check-prefix=CHECK-PIC1 -// RUN: %clang -c %s -target mipsel-linux-android16 -### 2>&1 \ -// RUN: | FileCheck %s --check-prefix=CHECK-PIE1 // RUN: %clang -c %s -target mipsel-linux-android24 -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-PIE1 // @@ -305,10 +287,6 @@ // Default value of PIE can be overwritten, even on 64-bit targets. // RUN: %clang -c %s -target arm-linux-androideabi -fPIE -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-PIE2 -// RUN: %clang -c %s -target i686-linux-android14 -fPIE -### 2>&1 \ -// RUN: | FileCheck %s --check-prefix=CHECK-PIE2 -// RUN: %clang -c %s -target i686-linux-android16 -fno-PIE -### 2>&1 \ -// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC // RUN: %clang -c %s -target aarch64-linux-android -fno-PIE -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC // RUN: %clang -c %s -target aarch64-linux-android24 -fno-PIE -### 2>&1 \ diff --git a/clang/test/Driver/sanitizer-ld.c b/clang/test/Driver/sanitizer-ld.c --- a/clang/test/Driver/sanitizer-ld.c +++ b/clang/test/Driver/sanitizer-ld.c @@ -148,8 +148,8 @@ // RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID %s // // CHECK-ASAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}" +// CHECK-ASAN-ANDROID: "-pie" // CHECK-ASAN-ANDROID-NOT: "-lc" -// CHECK-ASAN-ANDROID-NOT: "-pie" // CHECK-ASAN-ANDROID-NOT: "-lpthread" // CHECK-ASAN-ANDROID: libclang_rt.asan-arm-android.so" // CHECK-ASAN-ANDROID-NOT: "-lpthread" @@ -171,8 +171,8 @@ // RUN: | FileCheck --check-prefix=CHECK-UBSAN-ANDROID %s // // CHECK-UBSAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}" +// CHECK-UBSAN-ANDROID: "-pie" // CHECK-UBSAN-ANDROID-NOT: "-lc" -// CHECK-UBSAN-ANDROID-NOT: "-pie" // CHECK-UBSAN-ANDROID-NOT: "-lpthread" // CHECK-UBSAN-ANDROID: libclang_rt.ubsan_standalone-arm-android.so" // CHECK-UBSAN-ANDROID-NOT: "-lpthread" @@ -195,8 +195,8 @@ // RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-X86 %s // // CHECK-ASAN-ANDROID-X86: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}" +// CHECK-ASAN-ANDROID-X86: "-pie" // CHECK-ASAN-ANDROID-X86-NOT: "-lc" -// CHECK-ASAN-ANDROID-X86-NOT: "-pie" // CHECK-ASAN-ANDROID-X86-NOT: "-lpthread" // CHECK-ASAN-ANDROID-X86: libclang_rt.asan-i686-android.so" // CHECK-ASAN-ANDROID-X86-NOT: "-lpthread"