This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Use InitTargetOptionsFromCodeGenFlags/ParseCommandLineOptions for parsing LTO options.
ClosedPublic

Authored by grimar on Jan 31 2018, 6:07 AM.

Details

Summary

gold plugin uses InitTargetOptionsFromCodeGenFlags +
ParseCommandLineOptions for parsing LTO options.
Patch do the same change for LLD.

Such change helps to avoid parsing/whitelisting LTO
plugin options again on linker side, what can help LLD
to automatically support new -plugin-opt=xxx options
passed.

Diff Detail

Repository
rL LLVM

Event Timeline

grimar created this revision.Jan 31 2018, 6:07 AM
grimar accepted this revision.Feb 2 2018, 12:05 AM

LGTMed by Rafael in mail list.

This revision is now accepted and ready to land.Feb 2 2018, 12:05 AM
ruiu added inline comments.Feb 2 2018, 12:56 PM
ELF/Driver.cpp
587 ↗(On Diff #132159)

We have Config->Argv, so you don't need to pass Argv0 around.

697–698 ↗(On Diff #132159)

I don't think you need this comment. This comment doesn't seem to make much sense to me because you are not ignoring options but collecting options in this else if clause. I'd just remove this comment.

grimar updated this revision to Diff 132794.Feb 5 2018, 2:00 AM
  • Addressed review comments.
ELF/Driver.cpp
697–698 ↗(On Diff #132159)

Removed. Though it is unobvious I think that "/", "-fresolution=" and "-pass-through=" are options passed
for gold plugin and why should be ignored here.

I wonder if we actually want to error()/warn()/verbose them so that people could adjust their invocations to remove
excessive command line options when using lld instead gold+plugin.

ruiu accepted this revision.Feb 5 2018, 3:11 PM

LGTM

This revision was automatically updated to reflect the committed changes.