llvm-project/lld/MachO
Greg McGary 93c8559baf [lld-macho] Implement branch-range-extension thunks
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()

Differential Revision: https://reviews.llvm.org/D100818
2021-05-12 09:44:58 -07:00
..
Arch [lld-macho] Implement branch-range-extension thunks 2021-05-12 09:44:58 -07:00
CMakeLists.txt [lld-macho] Initial scaffolding for ARM32 support 2021-04-30 16:17:25 -04:00
Config.h [lld/mac] Implement -sectalign 2021-05-11 13:31:32 -04:00
Driver.cpp [lld-macho] Implement branch-range-extension thunks 2021-05-12 09:44:58 -07:00
Driver.h [lld-macho] Have --reproduce account for path rerooting 2021-05-05 14:41:01 -04:00
DriverUtils.cpp [lld-macho] Have --reproduce account for path rerooting 2021-05-05 14:41:01 -04:00
Dwarf.cpp [lld-macho][NFC] define more strings in section_names:: and segment_names:: 2021-04-27 17:48:45 -07:00
Dwarf.h [lld-macho] Emit STABS symbols for debugging, and drop debug sections 2020-12-01 15:05:20 -08:00
ExportTrie.cpp [lld-macho][NFC] add const to pointer/reference induction variables of range-based for loops 2021-03-10 12:07:31 -08:00
ExportTrie.h [lld-macho] Export trie addresses should be relative to the image base 2020-09-20 20:43:15 -07:00
InputFiles.cpp [lld-macho] Fix order file arch filtering 2021-05-10 15:45:54 -04:00
InputFiles.h [lld-macho] Support loading of zippered dylibs 2021-05-06 11:19:40 -04:00
InputSection.cpp [lld-macho] Implement branch-range-extension thunks 2021-05-12 09:44:58 -07:00
InputSection.h [lld-macho] Implement branch-range-extension thunks 2021-05-12 09:44:58 -07:00
LTO.cpp [lld-macho][nfc] Add accessors for commonly-used PlatformInfo fields 2021-04-21 15:43:56 -04:00
LTO.h [lld-macho] Add very basic support for LTO 2020-11-10 12:19:28 -08:00
MachOStructs.h [lld-macho] Add support for arm64_32 2021-04-15 21:16:33 -04:00
MapFile.cpp [lld/mac] Write every weak symbol only once in the output 2021-05-07 17:11:40 -04:00
MapFile.h [lld-macho] implement options -map 2021-03-18 10:39:19 -04:00
MergedOutputSection.cpp [lld-macho] Implement branch-range-extension thunks 2021-05-12 09:44:58 -07:00
MergedOutputSection.h [lld-macho] Implement branch-range-extension thunks 2021-05-12 09:44:58 -07:00
ObjC.cpp [lld-macho] De-templatize mach_header operations 2021-05-03 18:31:23 -04:00
ObjC.h [lld-macho] Implement -ObjC 2020-08-26 19:20:55 -07:00
Options.td [lld-macho] Implement branch-range-extension thunks 2021-05-12 09:44:58 -07:00
OutputSection.cpp [lld-macho] Refactor segment/section creation, sorting, and merging 2020-06-21 17:13:59 -07:00
OutputSection.h [lld-macho] Initial groundwork for -bitcode_bundle 2021-04-16 16:47:14 -04:00
OutputSegment.cpp [lld/mac] Implement -sectalign 2021-05-11 13:31:32 -04:00
OutputSegment.h [lld-macho][NFC] define more strings in section_names:: and segment_names:: 2021-04-27 17:48:45 -07:00
Relocations.cpp [lld-macho][nfc] Remove DYSYM8 reloc attribute 2021-04-09 19:48:08 -04:00
Relocations.h [lld-macho] Add 32-bit compact unwind support 2021-04-15 21:16:33 -04:00
SymbolTable.cpp [lld-macho] Treat undefined symbols uniformly 2021-05-10 15:45:54 -04:00
SymbolTable.h [lld-macho] Treat undefined symbols uniformly 2021-05-10 15:45:54 -04:00
Symbols.cpp [lld-macho] Implement branch-range-extension thunks 2021-05-12 09:44:58 -07:00
Symbols.h [lld-macho] Implement branch-range-extension thunks 2021-05-12 09:44:58 -07:00
SyntheticSections.cpp [lld-macho] Implement branch-range-extension thunks 2021-05-12 09:44:58 -07:00
SyntheticSections.h [lld-macho] Implement branch-range-extension thunks 2021-05-12 09:44:58 -07:00
Target.cpp [lld-macho][nfc] Create Relocations.{h,cpp} for relocation-specific code 2021-03-11 13:28:09 -05:00
Target.h [lld-macho] Implement branch-range-extension thunks 2021-05-12 09:44:58 -07:00
UnwindInfoSection.cpp [lld/mac] Copy some of the commit message of d5a70db193 into a comment 2021-05-08 13:03:17 -04:00
UnwindInfoSection.h [lld-macho] Add 32-bit compact unwind support 2021-04-15 21:16:33 -04:00
Writer.cpp [lld-macho] Implement branch-range-extension thunks 2021-05-12 09:44:58 -07:00
Writer.h [lld-macho] De-templatize mach_header operations 2021-05-03 18:31:23 -04:00