This is an archive of the discontinued LLVM Phabricator instance.

[llvm-driver] Add lld
ClosedPublic

Authored by abrachet on Jun 9 2022, 9:06 PM.

Details

Summary

The llvm-driver, enabled with LLVM_TOOL_LLVM_DRIVER_BUILD combines many llvm executables
into one to save overall toolchain size. This patch adds the capability for lld to be part of the
llvm-driver.

Diff Detail

Event Timeline

abrachet created this revision.Jun 9 2022, 9:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 9 2022, 9:06 PM
abrachet requested review of this revision.Jun 9 2022, 9:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 9 2022, 9:06 PM

Please add -DLLVM_TOOL_LLVM_DRIVER_BUILD=on to the summary. [llvm-driver] isn't clear.

Note: by using this, we lose the property to make clang and lld separately profile-guided optimized.

Since you work at Google, can I request that you fix llvm-project-overlay/lld/BUILD.bazel similar to llvm-project-overlay/clang/BUILD.bazel clang_main?
Otherwise it would cause some integration trouble...

llvm/test/tools/llvm-driver/passthrough-lld.test
5

may not be necessary to test -15 variants.

MaskRay requested changes to this revision.Jun 25 2022, 9:40 AM

Ping

This revision now requires changes to proceed.Jun 25 2022, 9:40 AM

I was considering holding off on this patch till after D127800 so that the diff would be simpler there. Or would you rather move ahead here first?

abrachet updated this revision to Diff 465822.Oct 6 2022, 12:08 PM
abrachet edited the summary of this revision. (Show Details)
abrachet marked an inline comment as done.Oct 6 2022, 12:10 PM

Please add -DLLVM_TOOL_LLVM_DRIVER_BUILD=on to the summary. [llvm-driver] isn't clear.

Done

Note: by using this, we lose the property to make clang and lld separately profile-guided optimized.

Yeah, that's a good observation I hadn't thought about. Likely the way clang and lld utilize libObject is very different for example. I can look into adding something along the lines of a LLVM_DRIVER_EXCLUDE_TOOLS list so it can chosen if some tools should be omitted.

Since you work at Google, can I request that you fix llvm-project-overlay/lld/BUILD.bazel similar to llvm-project-overlay/clang/BUILD.bazel clang_main?
Otherwise it would cause some integration trouble...

Done

I was considering holding off on this patch till after D127800 so that the diff would be simpler there. Or would you rather move ahead here first?

It actually didn't complicate things at all...

MaskRay added inline comments.Oct 7 2022, 8:03 PM
lld/include/lld/Common/Driver.h
28 ↗(On Diff #465822)

Seem unnecessary?

abrachet added inline comments.Oct 13 2022, 9:35 AM
lld/include/lld/Common/Driver.h
28 ↗(On Diff #465822)

I don't understand why, but T** doesn't implicitly convert to const T **, and the only way I could find to add the const qualifier to the inner pointer was through const_cast so I can either keep this as const char ** and const_cast in from lld_main or keep this as char **. WDYT?

MaskRay accepted this revision.Oct 13 2022, 10:39 AM
MaskRay added inline comments.
lld/include/lld/Common/Driver.h
28 ↗(On Diff #465822)

This should be fine. const is the preferred one (I just want to decouple unrelated changes....)

This revision is now accepted and ready to land.Oct 13 2022, 10:39 AM
This revision was landed with ongoing or failed builds.Oct 13 2022, 12:24 PM
This revision was automatically updated to reflect the committed changes.