This is an archive of the discontinued LLVM Phabricator instance.

clang: Pass -platform-version to new MachO LLD
ClosedPublic

Authored by thakis on Nov 24 2020, 8:02 AM.

Details

Summary

New MachO LLD doesn't implement the old -macos_version_min (etc)
flags, but it understands the modern platform_version flag.
So make the clang driver pass that when using new MachO LLD.

Also, while here, don't pass -lto_library to LLD, since it
links in LTO libraries statically (which it can because it's
versioned alongside clang).

Diff Detail

Event Timeline

thakis requested review of this revision.Nov 24 2020, 8:02 AM
thakis created this revision.
hans accepted this revision.Nov 24 2020, 8:09 AM
hans added inline comments.
clang/include/clang/Driver/ToolChain.h
334–337

ultra nit: the "in-progress" part doesn't really add much to the comment and might be obsolete soon, so i would probably have left that out. Also, strictly speaking, it's not immediately clear what the second "it" refers to here.

This revision is now accepted and ready to land.Nov 24 2020, 8:09 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptNov 24 2020, 8:16 AM
thakis marked an inline comment as done.Nov 24 2020, 8:20 AM

Thanks!

rsmith added a subscriber: rsmith.Jan 14 2021, 6:28 PM
rsmith added inline comments.
clang/lib/Driver/ToolChains/Darwin.cpp
341

Not a regression introduced by this change, but should this be

if ((Version[0] >= 520 && !LinkerIsLLD) || LinkerIsLLDDarwinNew)

? ld64.lld doesn't appear to understand -platform_version, and linking with clang -fuse-ld=lld on MacOS 10.15.7 seems to fail for this reason.