This is an archive of the discontinued LLVM Phabricator instance.

[clang][driver] Always add LTO options when using GNU toolchain
AbandonedPublic

Authored by tbaeder on Nov 19 2021, 2:09 AM.

Details

Summary

This is what the GCC driver does as well.

This way, ld.bfd can properly handle inputs from a clang LTO build,
without -flto being specified at link time explicitly.

Diff Detail

Event Timeline

tbaeder created this revision.Nov 19 2021, 2:09 AM
tbaeder requested review of this revision.Nov 19 2021, 2:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 19 2021, 2:09 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

The test failures are pretty obvious about when this fails. All affected builds have an implicit dependency on the LLVMgold.so like this.

tejohnson added inline comments.Nov 19 2021, 7:50 AM
clang/lib/Driver/ToolChains/Gnu.cpp
558

This will add a whole lot of options besides -plugin, which is the only thing guarded against for lld. But in general I'm not in favor of adding a dependence on having the LTO plugin available to all non-lld links by default.

This comment was removed by serge-sans-paille.
MaskRay requested changes to this revision.Nov 22 2021, 2:28 PM

Request changes according to the outstanding comment "But in general I'm not in favor of adding a dependence on having the LTO plugin available to all non-lld links by default."

Agree with tejohnson that this looks weird.

This revision now requires changes to proceed.Nov 22 2021, 2:28 PM
tbaeder abandoned this revision.Jan 4 2022, 4:44 AM