Page MenuHomePhabricator

Unconditionally pass -lto_library, remove -Wliblto warning.

Authored by thakis on Nov 22 2016, 11:32 AM.


Summary made it so that clang always checks if libLTO.dylib is present on disk, even if -flto is not being used. The motivation for that change was that if a dependency happens to contain bitcode, ld64 will try to load libLTO without -flto explicitly being enabled. However, the change had the undesirable side effect of warning if libLTO.dylib doesn't exist even if it isn't needed.

Change things so that -lto_library is always passes, independent of if it exists or not. ld64 only looks at this flag if it uses LTO. If the dylib exists, all is well. If it doesn't, and LTO is not being used, all is well too. If ld64 does end up using LTO and the dylib does not exist, ld64 will print something like

ld: could not process llvm bitcode object file, because foo/libLTO.dylib could not be loaded file 'test.o' for architecture x86_64

Diff Detail

Event Timeline

thakis retitled this revision from to Unconditionally pass -lto_library, remove -Wliblto warning..
thakis updated this object.
thakis added reviewers: rnk, mehdi_amini.
thakis added a subscriber: cfe-commits.
mehdi_amini accepted this revision.Nov 22 2016, 11:33 AM
mehdi_amini edited edge metadata.

LGTM, thanks!

This revision is now accepted and ready to land.Nov 22 2016, 11:33 AM
rnk accepted this revision.Nov 22 2016, 11:36 AM
rnk edited edge metadata.

lgtm, great idea!

thakis closed this revision.Nov 22 2016, 11:48 AM

287685, thanks!