summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r--clang/lib/Driver/Tools.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index a8d3f010bd0..bda4edfd07c 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -6917,7 +6917,10 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA,
ToolChain.getTriple().getEnvironment() == llvm::Triple::Android;
const bool IsPIE =
!Args.hasArg(options::OPT_shared) &&
- (Args.hasArg(options::OPT_pie) || ToolChain.isPIEDefault());
+ !Args.hasArg(options::OPT_static) &&
+ (Args.hasArg(options::OPT_pie) || ToolChain.isPIEDefault() ||
+ // On Android every code is PIC so every executable is PIE
+ isAndroid);
ArgStringList CmdArgs;
OpenPOWER on IntegriCloud