This is an archive of the discontinued LLVM Phabricator instance.

[lld/mac] Search .tbd before binary for framework files too
ClosedPublic

Authored by thakis on Sep 14 2021, 9:28 AM.

Details

Reviewers
gkm
int3
Group Reviewers
Restricted Project
Commits
rGed2f0ad30719: [lld/mac] Search .tbd before binary for framework files too
Summary

This matters for example for the iPhoneSimulator14.0.sdk, which has
a System/Library/Frameworks/UIKit.framework/UIKit that has
LC_BUILD_VERSION with minos of 14.0, so linking against that file
will produce warnings like:

.../iPhoneSimulator14.0.sdk/System/Library/Frameworks/UIKit.framework/UIKit
has version 14.0.0, which is newer than target minimum of 12.0.0

when targeting x86_64-apple-ios12.0-simulator. That doens't happen when
linking against UIKit.tbd instead, obviously.

Linking with RC_TRACE_DYLIB_SEARCHING=1 shows that ld64 also searches
the tbd file first, and we already get that right for non-framework
dylibs.

Fixes crbug.com/1249456.

Diff Detail

Event Timeline

thakis created this revision.Sep 14 2021, 9:28 AM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: pengfei. · View Herald Transcript
thakis requested review of this revision.Sep 14 2021, 9:28 AM
int3 accepted this revision.Sep 14 2021, 11:39 AM
int3 added a subscriber: int3.

Thanks!

This revision is now accepted and ready to land.Sep 14 2021, 11:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 14 2021, 12:27 PM