[patch] Forward the -O options to the linker

Chandler Carruth chandlerc at google.com
Sat Nov 1 19:04:40 PDT 2014


So, I vaguely don't like this....

I'm pretty comfortable with 'clang -O3 x.o y.o z.o -o my_binary' passing O3
to the LTO plugin, but less comfortable with passing it to the linker
itself. I'm not really sure why though, so I'm open to be convinced
otherwise. I don't have any principled stance here, it just seems somewhat
off.

I asked Rafael on IRC to check with GCC, and it requires "-Wl,-O3", and so
my current vote is for us to not invent a new convenience thing here. I'd
be interested if others disagree, and if so why.

On Mon, Oct 20, 2014 at 9:35 AM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> It is fairly common for -O to be passed to clang when linking and both
> bfd and gold support -O options, but currently the driver doesn't
> translate it and projects have to use -Wl,-O if they want to enable
> those options. In fact, our own build pass -O3, but not -Wl,-O.
>
> The attached patch translates and forwards the -O options to the linker.
>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141101/123f0695/attachment.html>


More information about the cfe-commits mailing list