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

Alexey Volkov avolkov.intel at gmail.com
Wed Feb 19 06:37:27 PST 2014


GCC doesn't parse -Wl options and also doesn't use -pie linker option for
PIC code generation on Android.
I see different handling of -fpic option on GCC and LLVM when running with
-flto:
GCC running with -fpic -flto will generate PIC code but LLVM with -fpic
-flto will not.
This happens both on Android and Linux.
Fixing this problem could solve original problem with -flto on Android.


2014-02-18 19:55 GMT+04:00 Rafael EspĂ­ndola <rafael.espindola at gmail.com>:

> On 18 February 2014 10:45, Alexey Volkov <avolkov.intel at gmail.com> wrote:
> > Hi Rafael,
> >
> > Before clang parses -Wl options there is some logic based on PIE, e.g.
> crt
> > object name selection.
> > One possible solution is to move -Wl options before crt objects.
> > But I am not sure if such reordering of linker arguments is possible.
> > Another solution is to parse -Wl option value directly before it is
> passed
> > to CmdArgs.
> > Do you have any other ideas?
>
> Unfortunately no. It does raise the question of when -Wl should be
> interpreted by the clang driver. If we parse it to decide if we are
> producing a shared object and don't need to also pass a PIE option, we
> should probably also parse it for deciding which crt object to use.
>
> On the other hand, if we don't parse it when deciding which crt object
> to use, then the correct behavior is probably to not parse the -Wl
> options at all and expect the user to use the driver equivalent ones
> (-shared for example). This would match gcc's behavior, no?
>
> Cheers,
> Rafael
>



-- 
Alexey Volkov
Intel Corporation
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140219/e47557b0/attachment.html>


More information about the llvm-commits mailing list