This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho] Account for alignment in thunk insertion algorithm
ClosedPublic

Authored by int3 on Feb 14 2023, 9:55 AM.

Details

Summary

We previously neglected this, leading us to underestimate the maximum
possible branch address offset.

Fixing this should allow us to reduce slop to more reasonable
levels. I've lowered it to 256 for now, though I suspect we could go
lower.

Fixes https://github.com/llvm/llvm-project/issues/59259.

Diff Detail

Event Timeline

int3 created this revision.Feb 14 2023, 9:55 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptFeb 14 2023, 9:55 AM
int3 requested review of this revision.Feb 14 2023, 9:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 14 2023, 9:55 AM

Thanks for providing a much more satisfying approach than the one I proposed in https://reviews.llvm.org/D144020 !

This revision is now accepted and ready to land.Feb 14 2023, 11:07 AM
int3 added a comment.Feb 14 2023, 11:36 AM

Sorry it took a while for me to get to fixing this -- been busy. Thanks for the review!

Some tests started failing on 32 bit here, the usual thing I think. Fixed in https://github.com/llvm/llvm-project/commit/0e1fb48bb95abaf94c0d21b58c4c075f6faad8ba, please correct if this was not your intent.

int3 added a comment.Feb 16 2023, 5:40 AM

Oops. Thanks for the fix!

thakis added a subscriber: thakis.May 19 2023, 5:34 AM

Noticed this while looking through commits. Great catch, thanks much! :)