This is an archive of the discontinued LLVM Phabricator instance.

[RuntimeDyld] Add allowStubs/allowZeroSyms
ClosedPublic

Authored by rafauler on Mar 3 2021, 5:45 PM.

Details

Summary

This patch introduces functionality used by BOLT when
re-linking the final binary. It adds to MemoryManager a new member
function allowStubAllocation to control whether this MemoryManager
supports increasing code size with stubs or not. Since BOLT can
rewrite some files in-place, it needs to avoid stub insertion done
by the linker. This patch also introduces allowsZeroSymbols to the
JITSymbolResolver class, enabling us to finish a link successfully
even when some symbols resolve to the value zero. When rewriting a
binary, sometimes we do need to resolve a target to zero in case
the input binary calls address zero and we want to be bug
compatible. We also expose reassignSectionAddress as it is used by
BOLT.

Diff Detail

Event Timeline

rafauler created this revision.Mar 3 2021, 5:45 PM
rafauler requested review of this revision.Mar 3 2021, 5:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 3 2021, 5:45 PM
lhames accepted this revision.May 8 2021, 8:03 PM

LGTM. Thanks Rafael!

(Obligatory observation: This is solved in JITLink, so when you're able to move to it the issue should disappear)

This revision is now accepted and ready to land.May 8 2021, 8:03 PM
This revision was automatically updated to reflect the committed changes.