This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho] Fold __objc_imageinfo sections
ClosedPublic

Authored by int3 on Jul 19 2022, 2:33 PM.

Details

Reviewers
thakis
Group Reviewers
Restricted Project
Commits
rGd23da0ec6c53: [lld-macho] Fold __objc_imageinfo sections
Summary

Previously, we treated it as a regular ConcatInputSection. However, ld64
actually parses its contents and uses that to synthesize a single image
info struct, generating one 8-byte section instead of `8 * number of
object files with ObjC code`.

I'm not entirely sure what impact this section has on the runtime, so I
just tried to follow ld64's semantics as closely as possible in this
diff. My main motivation though was to reduce binary size.

No significant perf change on chromium_framework on my 16-core Mac Pro:

           base           diff           difference (95% CI)
sys_time   1.764 ± 0.062  1.748 ± 0.032  [  -2.4% ..   +0.5%]
user_time  5.112 ± 0.104  5.106 ± 0.046  [  -0.9% ..   +0.7%]
wall_time  6.111 ± 0.184  6.085 ± 0.076  [  -1.6% ..   +0.8%]
samples    30             32

Diff Detail

Event Timeline

int3 created this revision.Jul 19 2022, 2:33 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 19 2022, 2:33 PM
int3 requested review of this revision.Jul 19 2022, 2:33 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 19 2022, 2:33 PM
int3 updated this revision to Diff 445961.Jul 19 2022, 3:39 PM

add test for invalid size

int3 planned changes to this revision.Jul 19 2022, 4:56 PM
int3 updated this revision to Diff 446009.Jul 19 2022, 6:34 PM

remove stray changes

int3 updated this revision to Diff 446021.Jul 19 2022, 8:05 PM

tweak comments

int3 planned changes to this revision.Jul 21 2022, 11:34 AM
int3 updated this revision to Diff 446613.Jul 21 2022, 1:13 PM
int3 edited the summary of this revision. (Show Details)

simplify

thakis accepted this revision.Jul 22 2022, 8:38 AM
thakis added a subscriber: thakis.

Seems alright.

This saves 8 bytes times num .o files, so order of ~100kiB?

This revision is now accepted and ready to land.Jul 22 2022, 8:38 AM
int3 added a comment.Jul 23 2022, 9:10 AM

Hm for chromium_framework it only saves 4560 bytes (4096 after alignment). I guess it would be more accurate to say it saves 8 * number of files with objC code. The size diff is a lot more significant in our internal apps presumably for that reason though (on the order of 100KiB indeed)

int3 edited the summary of this revision. (Show Details)Jul 23 2022, 9:11 AM
This revision was landed with ongoing or failed builds.Jul 23 2022, 9:12 AM
This revision was automatically updated to reflect the committed changes.