[PATCH] D100818: [lld-macho] Implement branch-range-extension thunks
Greg McGary via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 29 09:07:46 PDT 2021
gkm created this revision.
gkm added a reviewer: lld-macho.
Herald added subscribers: dang, kristof.beyls.
Herald added a reviewer: int3.
Herald added a project: lld-macho.
gkm updated this revision to Diff 340130.
gkm added a comment.
gkm updated this revision to Diff 341540.
gkm edited the summary of this revision.
gkm published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
- many updates
gkm added a comment.
- Major rewrite
Extend the range of calls beyond an architecture's limited branch range by first calling a thunk, which loads the far address into a scratch register (x16 on ARM64) and branches through it.
Other ports (COFF, ELF) use multiple passes with successively-refined guesses regarding the expansion of text-space imposed by thunk-space overhead. This MachO algorithm places thunks during MergedOutputSection::finalize() in a single pass using exact thunk-space overheads. Thunks are kept in a separate vector to avoid the overhead of inserting into the `inputs` vector of `MergedOutputSection`.
FIXME:
- arm64-stubs.s test is broken
- add thunk tests
- Handle thunks to DylibSymbol in MergedOutputSection::finalize()
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D100818
Files:
lld/MachO/Arch/ARM64.cpp
lld/MachO/Config.h
lld/MachO/Driver.cpp
lld/MachO/InputSection.cpp
lld/MachO/InputSection.h
lld/MachO/MergedOutputSection.cpp
lld/MachO/MergedOutputSection.h
lld/MachO/Options.td
lld/MachO/Relocations.h
lld/MachO/Symbols.cpp
lld/MachO/Symbols.h
lld/MachO/SyntheticSections.h
lld/MachO/Target.h
lld/MachO/Writer.cpp
lld/test/MachO/tools/generate-thunkable-program.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100818.341540.patch
Type: text/x-patch
Size: 26612 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210429/c7fdb6b6/attachment-0001.bin>
More information about the llvm-commits
mailing list