This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho] Support subtractor relocations that reference sections
ClosedPublic

Authored by int3 on Apr 19 2021, 4:32 PM.

Details

Summary

The minuend (but not the subtrahend) can reference a section.

Note that we do not yet properly validate that the subtrahend isn't
referencing a section; I've filed PR50034 to track that.

I've also extended the reloc-subtractor.s test to reorder symbols, to
make sure that the addends are being associated with the minuend (and not
the subtrahend) relocation.

Fixes PR49999.

Diff Detail

Event Timeline

int3 created this revision.Apr 19 2021, 4:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 19 2021, 4:32 PM
int3 requested review of this revision.Apr 19 2021, 4:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 19 2021, 4:32 PM
int3 added inline comments.Apr 19 2021, 4:55 PM
lld/MachO/Arch/X86_64.cpp
97

I hoisted this into the caller for uniformity (because in the case of subtractor relocs we need to handle the minuend's addend in the caller.)

int3 planned changes to this revision.Apr 19 2021, 6:53 PM
thakis accepted this revision.Apr 20 2021, 8:37 AM
This revision is now accepted and ready to land.Apr 20 2021, 8:37 AM
This revision was landed with ongoing or failed builds.Apr 20 2021, 1:59 PM
This revision was automatically updated to reflect the committed changes.