This is an archive of the discontinued LLVM Phabricator instance.

[llvm-objcopy][MachO] Fix the calculation of the output size
ClosedPublic

Authored by alexander-shaposhnikov on Oct 18 2020, 5:11 PM.

Details

Summary

Virtual sections do not contribute to the final output size.
This diff fixes the corresponding calculations in the method MachOWriter::totalSize.

Test plan: make check-all

Diff Detail

Event Timeline

alexander-shaposhnikov created this object with visibility "All Users".
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: abrachet. · View Herald Transcript
alexander-shaposhnikov requested review of this revision.Oct 18 2020, 5:11 PM
This revision is now accepted and ready to land.Oct 19 2020, 12:03 PM
alexander-shaposhnikov changed the visibility from "All Users" to "Public (No Login Required)".Oct 20 2020, 8:07 PM
MaskRay added inline comments.Oct 21 2020, 11:49 PM
llvm/tools/llvm-objcopy/MachO/MachOWriter.cpp
125

virtual section is a LLVM specific abstraction. Probably use zerofill?

llvm/tools/llvm-objcopy/MachO/MachOWriter.cpp
125

@MaskRay - are you referring to the message inside assert(...) ?

MaskRay added inline comments.Oct 22 2020, 12:11 AM
llvm/tools/llvm-objcopy/MachO/MachOWriter.cpp
125

Ah, yes. Though I think using "virtual" is fine as well, but in the Mach-O context it refers to specifically zerofill.

Update the message inside assert(...)

alexander-shaposhnikov edited the summary of this revision. (Show Details)Oct 22 2020, 1:24 PM
MaskRay accepted this revision.Oct 22 2020, 1:35 PM

LGTM.

This revision was landed with ongoing or failed builds.Oct 22 2020, 1:58 PM
This revision was automatically updated to reflect the committed changes.