[PATCH] Introduce new gold plugin option "relocation-pic"

Alexey Volkov avolkov.intel at gmail.com
Wed Apr 16 04:02:38 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 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.


http://reviews.llvm.org/D2668






More information about the llvm-commits mailing list