This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho] -all_load and -ObjC should not affect LC_LINKER_OPTION flags
ClosedPublic

Authored by int3 on Oct 28 2021, 1:57 PM.

Details

Summary

In particular, they should not cause archives to be eagerly loaded. This
matches ld64's behavior.

Fixes PR52246.

Diff Detail

Event Timeline

int3 created this revision.Oct 28 2021, 1:57 PM
Herald added a project: Restricted Project. · View Herald Transcript
int3 requested review of this revision.Oct 28 2021, 1:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 28 2021, 1:57 PM
int3 updated this revision to Diff 383157.Oct 28 2021, 1:59 PM

comments

thakis accepted this revision.Oct 28 2021, 6:42 PM
thakis added a subscriber: thakis.

Nice!

lld/MachO/Driver.cpp
271–272

nit: I'd s/!= ForceLoad::No/s == ForceLoad::Default/ since then the reader doesn't have to read line 257 to realize that ::Yes never comes here and hence is uninteresting

lld/test/MachO/lc-linker-option.ll
66

nit: I'd find "have no effect on libraries loaded via LC_LINKER_OPTION flags" clearer

68

nit: it's a bit weird to call a static library .dylib -- why not create a real dylib with lld? (up to you though)

This revision is now accepted and ready to land.Oct 28 2021, 6:42 PM
int3 added inline comments.Oct 29 2021, 7:51 AM
lld/test/MachO/lc-linker-option.ll
68

whoops, this was a brain fart

68

should have just been .a

This revision was automatically updated to reflect the committed changes.
int3 marked 2 inline comments as done.
int3 marked an inline comment as done.Oct 29 2021, 8:01 AM