This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho] Fix handling of X86_64_RELOC_SIGNED_{1,2,4}
ClosedPublic

Authored by int3 on Mar 10 2021, 7:42 PM.

Details

Reviewers
thakis
Group Reviewers
Restricted Project
Commits
rGe8a305830335: [lld-macho] Fix handling of X86_64_RELOC_SIGNED_{1,2,4}
Summary

The previous implementation miscalculated the addend, resulting
in an underflow. This meant that every SIGNED_N section relocation would
be associated with the last subsection (since the addend would now be a
huge number). We were "lucky" that this mistake was typically cancelled
out -- 64-to-32-bit-truncation meant that the final value was correct,
as long as subsections were not rearranged.

Diff Detail

Event Timeline

int3 created this revision.Mar 10 2021, 7:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 10 2021, 7:42 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
int3 requested review of this revision.Mar 10 2021, 7:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 10 2021, 7:42 PM
thakis accepted this revision.Mar 11 2021, 7:29 AM
thakis added a subscriber: thakis.
thakis added inline comments.
lld/MachO/InputFiles.cpp
308

nit: llvm uses "FIXME" as the default todo comment, not XXX or TODO

This revision is now accepted and ready to land.Mar 11 2021, 7:29 AM
This revision was automatically updated to reflect the committed changes.
int3 marked an inline comment as done.