This is an archive of the discontinued LLVM Phabricator instance.

[NFCI][clang][driver] Identify LTO plugin types and refine opt passing
AcceptedPublic

Authored by daltenty on Feb 6 2022, 11:11 PM.

Details

Summary

This patch introduce a set of LTO plugin types required by various
linkers (i.e. gold and lld) and accompanying plugin option forwarding
forms. The appropriate option passing form can then be queried at the
point we forward options to pass on LTO.

We use these new interfaces in an lto plugin option creation function
we use to refactor addLTOOptions and helper functions so it is mostly
invariant to option form in use and introducing a new plugin option type
is possible (which we will do for AIX ld in a sub-sequent patch).

As part of the common-ing, some opt remarks cases are slightly adjusted
to use a single dash form of -plugin-opt (gold and lld accept both).
We also remove -fuse-ld=dummy from a test as this is not a valid or
documented option and causes failures after the refactor.

co-authored-by: Ettore Tiotto <etiotto@ca.ibm.com>
co-authored-by: Wai Hung Tsang <whitneyt@ca.ibm.com>

Diff Detail

Event Timeline

daltenty created this revision.Feb 6 2022, 11:11 PM
daltenty requested review of this revision.Feb 6 2022, 11:11 PM
daltenty updated this revision to Diff 406607.Feb 7 2022, 2:16 PM

Run clang-format

daltenty updated this revision to Diff 406608.Feb 7 2022, 2:18 PM

Remove whitespace change

Whitney added inline comments.Feb 8 2022, 5:34 PM
clang/lib/Driver/ToolChains/CommonArgs.cpp
68

Looks like Seperator is either nullptr or -, is there a reason why it is not simply a boolean to see if a dash is needed?

109

Why specify the default value for Seperator?

daltenty added inline comments.Feb 14 2022, 8:34 AM
clang/lib/Driver/ToolChains/CommonArgs.cpp
68

Thanks, I actually had that arrangement in an earlier draft, not sure why I switched anymore. I'll switch it back.

109

Ah, originally I was passing this function a lambda before refactoring. I'll fix this.

daltenty updated this revision to Diff 408436.Feb 14 2022, 8:36 AM

Change seperator option type to bool

Whitney accepted this revision.Feb 14 2022, 10:24 AM
This revision is now accepted and ready to land.Feb 14 2022, 10:24 AM
daltenty updated this revision to Diff 408857.Feb 15 2022, 7:01 AM

Add missing semicolon

daltenty updated this revision to Diff 408922.Feb 15 2022, 9:28 AM

clang-format