[PATCH] Introduce new gold plugin option "relocation-pic"
Alexey Samsonov
samsonov at google.com
Wed Apr 16 13:31:03 PDT 2014
================
Comment at: lib/Driver/Tools.cpp:6845
@@ -6845,1 +6844,3 @@
+ !Args.hasArg(options::OPT_static) &&
+ (Args.hasArg(options::OPT_pie) || ToolChain.isPIEDefault() || isAndroid);
----------------
Alexey Volkov wrote:
> Alexey Samsonov wrote:
> > I don't understand this part - effectively you're making -pie the default on Android. Is it really the intended behavior?
> >
> > If yes, shouldn't you implement it in ToolChain.isPIEDefault() instead?
> Flag -pie passed to linker solved original problem with LTO on Android.
> So it is needed when generating executables on Android with LTO enabled.
> Also PIE would be useful for any executables on Android but it will not work for libraries.
> Implementing PIE in ToolChain.isPIEDefault() will turn it on for all objects since compiler doesn't know if objects will be used for executable or for library.
Ok. I also see that you can probably do this because -fpic/-fPIC flags are implied for Android on certain architectures (in Clang::ConstructJob method). But, anyway, unconditionally ignoring the presence/absence of -pie flag on Android is a serious change, which might be surprising for end-user. Is it possible to imply "-pie" iff LTO is enabled?
http://reviews.llvm.org/D2668
More information about the llvm-commits
mailing list