This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho] Add implicit dylib support for frameworks
ClosedPublic

Authored by int3 on Dec 14 2020, 10:00 PM.

Details

Reviewers
thakis
Group Reviewers
Restricted Project
Commits
rG3aa8e071dd1a: [lld-macho] Add implicit dylib support for frameworks
Summary

D93000: [lld-macho] Implement `-no_implicit_dylibs` applied to frameworks. Partial fix for PR48511.

Diff Detail

Event Timeline

int3 requested review of this revision.Dec 14 2020, 10:00 PM
int3 created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 14 2020, 10:00 PM
int3 added a subscriber: thakis.Dec 14 2020, 10:02 PM

@thakis I'm unable to properly test PR48511 as the CoreGraphics on my local system seems to have a slightly different set of symbols (despite it being version 10.15.7 too). However, the binary is now trying to import the symbol from CoreGraphics rather than ApplicationServices, so I think this diff is on the right track.

Thanks! I tested this and put the details in https://bugs.llvm.org/show_bug.cgi?id=48511#c3 and https://bugs.llvm.org/show_bug.cgi?id=48511#c5 . Summary: This is a good change, but it's not sufficient for that bug. One comment about pedantic correctness below :)

lld/MachO/InputFiles.cpp
514

This matches File<A>::isPublicLocation in ld64 which lists a few special cases here https://github.com/apple-opensource/ld64/blob/fd3feabb0a1eb18ab5d7910f3c3a5eed99cef6ab/src/ld/parsers/generic_dylib_file.hpp#L490 that this code as-is doesn't quite get right yet I think:

		// but only top level framework
		// /System/Library/Frameworks/Foo.framework/Versions/A/Foo                 ==> true
		// /System/Library/Frameworks/Foo.framework/Resources/libBar.dylib         ==> false
		// /System/Library/Frameworks/Foo.framework/Frameworks/Bar.framework/Bar   ==> false
		// /System/Library/Frameworks/Foo.framework/Frameworks/Xfoo.framework/XFoo ==> false
thakis accepted this revision.Dec 15 2020, 6:38 AM

I suppose even with the pedantic correctness thing fixed it's a progression, so I should lg. But probably good to get it fully right immediately so we can consider implicit_dylibs as done and forget about it -- I'd recommend implementing that suggestion before committing :)

This revision is now accepted and ready to land.Dec 15 2020, 6:38 AM
int3 added inline comments.Dec 15 2020, 9:26 AM
lld/MachO/InputFiles.cpp
514

I think the code gets this right, but I'll extend the test to verify :)

int3 updated this revision to Diff 311956.Dec 15 2020, 10:06 AM
int3 marked an inline comment as done.

verify that we only re-export top-level frameworks

int3 edited the summary of this revision. (Show Details)Dec 15 2020, 12:38 PM
This revision was landed with ongoing or failed builds.Dec 15 2020, 1:00 PM
This revision was automatically updated to reflect the committed changes.