[PATCH] D36227: [ELF] - LTO: Try to be option compatible with the gold plugin.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 3 17:36:37 PDT 2017


George Rimar via Phabricator <reviews at reviews.llvm.org> writes:

> grimar added inline comments.
>
>
> ================
> Comment at: ELF/Driver.cpp:623
> +                                      StringRef Opt, unsigned Default) {
> +  for (auto *Arg : Args.filtered(Key, OPT_plugin_opt, OPT_plugin_opt_eq)) {
> +    StringRef Val;
> ----------------
> ruiu wrote:
>> This function is unnecessarily too complicated. Don't mix Key with other plugin options. Handle Key first, and then if Key does not exist, handle others. I.e.
>> 
>>   if (Args.hasArg(Key))
>>     return getInteger(Args, Key, Default);
>>   ...
> If I do that then mix of options will work incorrectly, example:
>
> `ld.lld --lto-O0 --plugin-opt=O6 ...`
>
> will set optimization level 0 instead of 6

Do we have to worry about that? --plugin-opt is likely to only show up
in Makefiles that are using gold and those will not have lld options.

I would probably just give preference to lld options over --plugin-opt*
options.

Cheers,
Rafael


More information about the llvm-commits mailing list