This is an archive of the discontinued LLVM Phabricator instance.

[LLD][ELF] Fix --check-dynamic-relocations for 32-bit targets
ClosedPublic

Authored by andrewng on Apr 27 2023, 7:41 AM.

Details

Summary

OutputSection::checkDynRelAddends() incorrectly reports an internal
linker error for large addends on 32-bit targets. This is caused by the
lack of sign extension in DynamicReloc::computeAddend() for 32-bit
addends.

Diff Detail

Event Timeline

andrewng created this revision.Apr 27 2023, 7:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 27 2023, 7:41 AM
Herald added a subscriber: emaste. · View Herald Transcript
andrewng requested review of this revision.Apr 27 2023, 7:41 AM

Change looks sensible to me but the test could do with some kind of explanation of what it's doing.

lld/test/ELF/arm-pie-relative.s
6

This test could do with a comment or some check lines?

MaskRay added inline comments.Apr 27 2023, 7:45 PM
lld/ELF/SyntheticSections.cpp
1568
lld/test/ELF/arm-pie-relative.s
6

Adding a llvm-readelf -x .got will make it more useful.

andrewng updated this revision to Diff 517893.Apr 28 2023, 6:21 AM

Updated to address review comments and suggestions.

andrewng marked 3 inline comments as done.Apr 28 2023, 6:21 AM
MaskRay accepted this revision.Apr 28 2023, 9:57 AM

Looks great!

This revision is now accepted and ready to land.Apr 28 2023, 9:57 AM
This revision was landed with ongoing or failed builds.May 3 2023, 3:21 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMay 3 2023, 3:21 AM