This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho] Handle alignment correctly when merging InputSections
ClosedPublic

Authored by int3 on Jun 5 2020, 12:49 PM.

Details

Summary

Previously, we weren't updating isecAddr when aligning InputSections,
resulting in truncated sections under the right conditions.

Diff Detail

Event Timeline

int3 created this revision.Jun 5 2020, 12:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 5 2020, 12:49 PM
int3 updated this revision to Diff 268916.Jun 5 2020, 12:57 PM

rename i -> isec for consistency

compnerd added inline comments.
lld/test/MachO/section-merge.s
15

Where is ADDR captured? I can't seem to spot it.

int3 marked an inline comment as done.Jun 7 2020, 9:55 PM
int3 added inline comments.
lld/test/MachO/section-merge.s
15

it's captured on line 13

compnerd accepted this revision.Jun 8 2020, 9:28 AM

Ah, somehow I inverted the application and read it as a check rather than capture, thanks!

This revision is now accepted and ready to land.Jun 8 2020, 9:28 AM

The fix and test for it look good, but the previous test was also checking that section contents were being merged correctly, which is being dropped. Could you add that back?

int3 updated this revision to Diff 270607.Jun 13 2020, 11:40 PM

check that section contents are being merged correctly

int3 added a comment.Jun 13 2020, 11:41 PM

@smeenai Oh yeah good point. I've added some nonzero data to the data section, so it can double up as a check for the correctness of the contents too. Just wanted to make the test as compact as possible

smeenai accepted this revision.Jun 15 2020, 12:05 PM
This revision was automatically updated to reflect the committed changes.