[PATCH] Introduce new gold plugin option "relocation-pic"
Alexey Volkov
avolkov.intel at gmail.com
Thu Feb 13 05:46:12 PST 2014
Hi Rafael,
I've rewritten my patch with "-pie" linker option.
Unfortunately I couldn't use isPIEDefault function since PIE will be turned on for all objects generated in Clang::ConstructJob.
Analysis of compiler options is not sufficient since the same object can be used for library or for executable.
Hi rafael,
http://llvm-reviews.chandlerc.com/D2668
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D2668?vs=6795&id=7051#toc
Files:
lib/Driver/Tools.cpp
test/Driver/gold-lto.c
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -6547,7 +6547,9 @@
const SanitizerArgs &Sanitize = ToolChain.getSanitizerArgs();
const bool IsPIE =
!Args.hasArg(options::OPT_shared) &&
- (Args.hasArg(options::OPT_pie) || Sanitize.hasZeroBaseShadow());
+ !Args.hasArg(options::OPT_static) &&
+ (Args.hasArg(options::OPT_pie) || Sanitize.hasZeroBaseShadow() ||
+ isAndroid);
ArgStringList CmdArgs;
Index: test/Driver/gold-lto.c
===================================================================
--- test/Driver/gold-lto.c
+++ test/Driver/gold-lto.c
@@ -19,3 +19,8 @@
// CHECK-ARM-V7A: "-plugin" "{{.*}}/LLVMgold.so"
// CHECK-ARM-V7A: "-plugin-opt=mcpu=cortex-a8"
// CHECK-ARM-V7A: "-plugin-opt=foo"
+//
+// 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"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2668.2.patch
Type: text/x-patch
Size: 1048 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140213/abf11970/attachment.bin>
More information about the llvm-commits
mailing list