This is an archive of the discontinued LLVM Phabricator instance.

[lld-link] implement -lto-obj-path
ClosedPublic

Authored by inglorion on Aug 8 2019, 11:30 AM.

Details

Summary

This adds the -lto-obj-path option to lld-link. This can be
used to specify a path at which to write a native object file for
the full LTO part when using LTO unit splitting.

Event Timeline

inglorion created this revision.Aug 8 2019, 11:30 AM
rnk added a comment.Aug 8 2019, 3:22 PM

I think the command line flag needs a better name to indicate that it's the destination for the merged, whole-program bitcode file. In ELF, the config name is ltoObjPath, and the flag is -plugin-opt=obj-path=. I think we can be more descriptive. How about: -split-bc-path:, -merged-bc-path:, -lto-bc-path, or something else descriptive?

In ELF, the config name is ltoObjPath, and the flag is -plugin-opt=obj-path=

Yes. That's how I came up with -thinlto-obj-path. All the ThinLTO options that are -plugin-opt=??? in the ELF are -thinlto-??? in the COFF linker.

That said, I'm not opposed to giving this a more descriptive name. Since this is the path to the native object file we get out of LTO, how about -lto-merged-obj?

@rnk, what do you think of the name I proposed?

rnk added a subscriber: rdhindsa.Aug 12 2019, 4:34 PM

-lto-merged-obj sounds good to me, unless anyone objects. I see it was added to the gold plugin back in rL125663, and @rdhindsa ported it to LLD LTO in rL331817.

I don't want to use the -thinlto prefix, since this should affect regular LTO as well.

After discussion in person, we decided on -lto-obj-path: similar to the naming in the ELF linker, and we'

'll call the Config field ltoObjPath, same as in the ELF linker.

inglorion updated this revision to Diff 215708.Aug 16 2019, 4:17 PM
inglorion retitled this revision from [lld-link] implement -thinlto-obj-path to [lld-link] implement -lto-obj-path.
inglorion edited the summary of this revision. (Show Details)
inglorion removed a subscriber: rdhindsa.

changed flag name to -lto-obj-path:

rnk accepted this revision.Aug 17 2019, 4:48 PM

lgtm

This revision is now accepted and ready to land.Aug 17 2019, 4:48 PM
ruiu accepted this revision.Aug 18 2019, 11:11 PM

LGTM

This revision was automatically updated to reflect the committed changes.