This is an archive of the discontinued LLVM Phabricator instance.

[cmake] Make LLVM_ENABLE_LLD=ON work better on macOS
ClosedPublic

Authored by thakis on Nov 2 2021, 7:40 AM.

Details

Summary

LLVM_LINKER_IS_LLD is now set with LLVM_ENABLE_LLD=ON (or LLVM_USER_LINKER=lld)
even on APPLE, and we pass -Wl,-order_file when LLVM_LINKER_IS_LLD on APPLE
too.

To make this straightforward, change the linker detection logic to go through
the compiler driver on APPLE like on the other platforms.

No intended behavior change if LLVM_ENABLE_LLD isn't set.

Diff Detail

Event Timeline

thakis created this revision.Nov 2 2021, 7:40 AM
thakis requested review of this revision.Nov 2 2021, 7:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 2 2021, 7:40 AM
hans accepted this revision.Nov 2 2021, 7:49 AM

lgtm with one question

llvm/cmake/modules/AddLLVM.cmake
170

nit: maybe add a period while here.

179

nit: maybe drop the spaces while here.

196

isn't it enough to check one stream?

This revision is now accepted and ready to land.Nov 2 2021, 7:49 AM
thakis added inline comments.Nov 2 2021, 10:33 AM
llvm/cmake/modules/AddLLVM.cmake
196

Yes, but lld currently writes it to stdout – but since ld64 writes to stderr that's an lld bug that we should fix (in D113020 :) ) so then this needs to support both behaviors, at least for a while.

thakis marked an inline comment as done.Nov 2 2021, 10:34 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptNov 2 2021, 10:35 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript