This is an archive of the discontinued LLVM Phabricator instance.

[dsymutil] Fix offset calculation for fat binaries
ClosedPublic

Authored by JDevlieghere on Mar 8 2023, 6:20 PM.

Details

Summary

The Mach-O file format uses 32-bit values to encodes offsets which they cannot exceed UIN32_MAX (4GB). The Mach-O file itself can be larger than 4GB as long as none of the offsets fall within this limit. For universal binaries, dsymutil determines if the offset is going to exceed the 4GB limit by computing the size of the header and adding it to the size of all the slices. This is incorrect because it computes the end offset of the final slice. For the purpose of the 4GB limit, only the starting offset matters. The size of the last slice is irrelevant as long as it itself is a valid Mach-O.

rdar://104435018

Diff Detail

Event Timeline

JDevlieghere created this revision.Mar 8 2023, 6:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 8 2023, 6:20 PM
JDevlieghere requested review of this revision.Mar 8 2023, 6:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 8 2023, 6:20 PM
clayborg accepted this revision.Mar 9 2023, 9:52 AM
This revision is now accepted and ready to land.Mar 9 2023, 9:52 AM