
This supersedes https://github.com/llvm/llvm-project/pull/87818 and fixes https://github.com/llvm/llvm-project/issues/52767 When calculating arm64 thunks, we make a few assumptions that may not hold when considering code sections outside of `__text`: 1. That a section needs thunks only if its size is larger than the branch range. 2. That any calls into `__stubs` are necessarily forward jumps (that is, the section with the jump is ordered before `__stubs`) Sections like this exist in the wild, most prominently the `__lcxx_overrides` section introduced in https://github.com/llvm/llvm-project/pull/69498 This change: - Ensures that if one section in `__TEXT` gets thunks, all of them do. - Makes all code sections in `__TEXT` contiguous (and guaranteed to be placed before `__stubs`)
63 lines
1015 B
CMake
63 lines
1015 B
CMake
set(LLVM_TARGET_DEFINITIONS Options.td)
|
|
tablegen(LLVM Options.inc -gen-opt-parser-defs)
|
|
add_public_tablegen_target(MachOOptionsTableGen)
|
|
|
|
include_directories(${LLVM_MAIN_SRC_DIR}/../libunwind/include)
|
|
|
|
add_lld_library(lldMachO
|
|
Arch/ARM64.cpp
|
|
Arch/ARM64Common.cpp
|
|
Arch/ARM64_32.cpp
|
|
Arch/X86_64.cpp
|
|
ConcatOutputSection.cpp
|
|
Driver.cpp
|
|
DriverUtils.cpp
|
|
Dwarf.cpp
|
|
EhFrame.cpp
|
|
ExportTrie.cpp
|
|
ICF.cpp
|
|
InputFiles.cpp
|
|
InputSection.cpp
|
|
LTO.cpp
|
|
MapFile.cpp
|
|
MarkLive.cpp
|
|
ObjC.cpp
|
|
OutputSection.cpp
|
|
OutputSegment.cpp
|
|
Relocations.cpp
|
|
SectionPriorities.cpp
|
|
Sections.cpp
|
|
SymbolTable.cpp
|
|
Symbols.cpp
|
|
SyntheticSections.cpp
|
|
Target.cpp
|
|
UnwindInfoSection.cpp
|
|
Writer.cpp
|
|
|
|
LINK_COMPONENTS
|
|
${LLVM_TARGETS_TO_BUILD}
|
|
BinaryFormat
|
|
BitReader
|
|
BitWriter
|
|
Core
|
|
DebugInfoDWARF
|
|
Demangle
|
|
LTO
|
|
MC
|
|
ObjCARCOpts
|
|
Object
|
|
Option
|
|
Passes
|
|
Support
|
|
TargetParser
|
|
TextAPI
|
|
|
|
LINK_LIBS
|
|
lldCommon
|
|
${LLVM_PTHREAD_LIB}
|
|
|
|
DEPENDS
|
|
MachOOptionsTableGen
|
|
${tablegen_deps}
|
|
)
|