[PATCH] Always add LLVMgold.so plugin if it's present in the standard location

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Feb 18 12:01:43 PST 2014


On 18 February 2014 14:25, Tom Roeder <tmroeder at google.com> wrote:
> The attached patch changes the behavior of the driver to always add
> LLVMgold.so if it can find it in ../lib/LLVMgold.so. This is the
> location it was already using if the -flto flag was passed.
>
> The goal here is to make it easier to apply -flto in large codebases
> containing multiple projects. E.g., when I was working on building
> Chromium with LTO, one of the problems I encountered is that some
> projects would end up depending on files that had been built as
> bitcode. And these projects then needed to be modified to add -flto so
> they could use the bitcode files. It seems natural, at least to me,
> that clang should be able to handle .o or .a files that are bitcode
> without requiring -flto explicitly.
>
> This is my first patch sent to cfe-commits, and I don't know the clang
> part of the codebase as well as the LLVM bits, so please let me know
> if I'm missing something here. I thought it was going to be more
> complicated to change this behavior, and I find it hard to believe
> that it's quite as simple as this patch makes it seem.

The idea is interesting, but there are two potential issues:

What will bfd ld and gold do with -plugin if they are compiled without
plugin support? Error or just ignore the option? If error, how common
is it for distros to build them without plugin support?

What is the performance impact of passing -plugin when no LTO is being done?

Cheers,
Rafael



More information about the cfe-commits mailing list