This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Enable new passmanager plugin support for LTO
ClosedPublic

Authored by jkl on Feb 24 2022, 8:10 AM.

Details

Summary

add cli options for new passmanager plugin support to lld.

Currently it is not possible to load dynamic NewPM plugins with lld.
This is an incremental update to D76866.
While that patch only added cli options for llvm-lto2, this adds them
for lld as well.
This is especially useful for running dynamic plugins
on the linux kernel with LTO.

Diff Detail

Event Timeline

jkl created this revision.Feb 24 2022, 8:10 AM
jkl requested review of this revision.Feb 24 2022, 8:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 24 2022, 8:10 AM

Just some drive-by comments, but in general I think this would be nice to get fixed.

lld/ELF/Config.h
150
lld/ELF/Driver.cpp
1290–1292
lld/ELF/LTO.cpp
150
llvm/test/Feature/load_extension.ll
9 ↗(On Diff #411134)

This seems like it should be a test in lld/test instead of LLVM?

jkl added a comment.Feb 25 2022, 11:53 AM

I guess the syntax changes depend on whether the code should be in sync with the llvm-link2 version or not.
I'll leave it as it is, to get the preference of others.

Herald added a project: Restricted Project. · View Herald TranscriptMar 1 2022, 8:59 PM

Generally looks fine, barring any concerns with code style.

jkl updated this revision to Diff 413854.Mar 8 2022, 9:52 AM

I fixed the styling changes suggested.

jkl marked 3 inline comments as done.Mar 10 2022, 6:59 AM
MaskRay added inline comments.Mar 11 2022, 5:48 PM
lld/ELF/Config.h
150

passPlugins

MaskRay requested changes to this revision.Mar 11 2022, 5:48 PM
MaskRay added inline comments.
llvm/test/Feature/load_extension.ll
9 ↗(On Diff #413854)

llvm/test tests cannot use ld.lld

This revision now requires changes to proceed.Mar 11 2022, 5:48 PM
jkl updated this revision to Diff 417122.Mar 21 2022, 3:56 PM

With the help of @teemperor I moved the test into lld/test but since this is using the Bye pass, we had to enable that for lld.

jkl marked an inline comment as done.Mar 21 2022, 3:57 PM
MaskRay added inline comments.Mar 22 2022, 8:45 PM
lld/ELF/Config.h
150

Move this before std::vector<llvm::StringRef> searchPaths;

lld/ELF/LTO.cpp
150
lld/test/ELF/lto/ltopasses-extension.ll
6

We don't need legacy PM tests. It will go away soon.

jkl updated this revision to Diff 417522.Mar 23 2022, 1:17 AM
jkl marked 3 inline comments as done.Mar 23 2022, 1:18 AM
MaskRay added inline comments.Mar 23 2022, 8:53 PM
lld/ELF/LTO.cpp
150

Not done: StringRef instead of StringRef &

jkl updated this revision to Diff 417821.Mar 23 2022, 9:19 PM
jkl updated this revision to Diff 417822.Mar 23 2022, 9:20 PM
jkl marked an inline comment as done.Mar 23 2022, 9:21 PM

sorry, my bad I missed that. Fixed now.

MaskRay accepted this revision.Mar 23 2022, 10:01 PM
MaskRay retitled this revision from lld: Enable new passmanager plugin support for LTO to [ELF] Enable new passmanager plugin support for LTO.
MaskRay added inline comments.
lld/ELF/Options.td
720
lld/test/ELF/lto/ltopasses-extension.ll
5

Don't leave output in the current directory (which may be read-only in some downstream groups)

This revision is now accepted and ready to land.Mar 23 2022, 10:01 PM
This revision was landed with ongoing or failed builds.Mar 24 2022, 12:09 AM
This revision was automatically updated to reflect the committed changes.
dyung added a subscriber: dyung.Mar 24 2022, 1:26 AM

This change is causing CMake failures on at least 2 different bots due to a missing dependency target "Bye". Can you take a look?

https://lab.llvm.org/buildbot/#/builders/139/builds/19115
https://lab.llvm.org/buildbot/#/builders/98/builds/15274

Thanks, reverting while investigating.