summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2015-03-03 18:24:57 +0000
committerDan Albert <danalbert@google.com>2015-03-03 18:24:57 +0000
commit77214a4498508a92b906494caad65e85d16295c3 (patch)
treef08d62ae5e55d6be0b0d960960bf0e4b56327148
parent675cffcb91353b00bcc23f15e879925f6a0e1db3 (diff)
downloadbcm5719-llvm-77214a4498508a92b906494caad65e85d16295c3.tar.gz
bcm5719-llvm-77214a4498508a92b906494caad65e85d16295c3.zip
Don't force -pie for Android.
Summary: There is no -no-pie flag that can override this, so making it default to being on for Android means it is no longer possible to create non-PIE executables on Android. While current versions of Android support (and the most recent requires) PIE, ICS and earlier versions of Android cannot run PIE executables, so this needs to be optional. Reviewers: srhines Reviewed By: srhines Subscribers: thakis, volkalexey, cfe-commits Differential Revision: http://reviews.llvm.org/D8015 llvm-svn: 231091
-rw-r--r--clang/lib/Driver/Tools.cpp6
-rw-r--r--clang/test/Driver/gold-lto.c1
-rw-r--r--clang/test/Driver/linux-ld.c25
3 files changed, 26 insertions, 6 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 17b430c316c..5d66605c257 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -7576,11 +7576,7 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA,
const bool IsPIE =
!Args.hasArg(options::OPT_shared) &&
!Args.hasArg(options::OPT_static) &&
- (Args.hasArg(options::OPT_pie) || ToolChain.isPIEDefault() ||
- // On Android every code is PIC so every executable is PIE
- // Cannot use isPIEDefault here since otherwise
- // PIE only logic will be enabled during compilation
- isAndroid);
+ (Args.hasArg(options::OPT_pie) || ToolChain.isPIEDefault());
ArgStringList CmdArgs;
diff --git a/clang/test/Driver/gold-lto.c b/clang/test/Driver/gold-lto.c
index 18a293b6960..db6786ffd8b 100644
--- a/clang/test/Driver/gold-lto.c
+++ b/clang/test/Driver/gold-lto.c
@@ -22,5 +22,4 @@
//
// RUN: %clang -target i686-linux-android -### %t.o -flto 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-X86-ANDROID
-// CHECK-X86-ANDROID: "-pie"
// CHECK-X86-ANDROID: "-plugin" "{{.*}}/LLVMgold.so"
diff --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c
index b431b1c7489..f2e6eda3ffb 100644
--- a/clang/test/Driver/linux-ld.c
+++ b/clang/test/Driver/linux-ld.c
@@ -1093,6 +1093,31 @@
// CHECK-ANDROID-PIE: "{{.*}}{{/|\\\\}}crtend_android.o"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=arm-linux-androideabi \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=arm-linux-android \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=aarch64-linux-android \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=arm64-linux-android \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=mipsel-linux-android \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=mips64el-linux-android \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=i686-linux-android \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=x86_64-linux-android \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s
+// CHECK-ANDROID-NO-DEFAULT-PIE-NOT: -pie
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=arm-linux-androideabi \
// RUN: --gcc-toolchain="" \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-32 %s
OpenPOWER on IntegriCloud