2020-04-03 02:54:05 +08:00
|
|
|
set(LLVM_TARGET_DEFINITIONS Options.td)
|
|
|
|
tablegen(LLVM Options.inc -gen-opt-parser-defs)
|
|
|
|
add_public_tablegen_target(MachOOptionsTableGen)
|
|
|
|
|
2020-08-21 04:05:13 +08:00
|
|
|
include_directories(${LLVM_MAIN_SRC_DIR}/../libunwind/include)
|
|
|
|
|
2020-04-03 02:54:05 +08:00
|
|
|
add_lld_library(lldMachO2
|
|
|
|
Arch/X86_64.cpp
|
2020-09-27 04:00:22 +08:00
|
|
|
Arch/ARM64.cpp
|
2020-08-21 04:05:13 +08:00
|
|
|
UnwindInfoSection.cpp
|
2020-04-03 02:54:05 +08:00
|
|
|
Driver.cpp
|
2020-08-14 04:48:47 +08:00
|
|
|
DriverUtils.cpp
|
[lld-macho] Emit STABS symbols for debugging, and drop debug sections
Debug sections contain a large amount of data. In order not to bloat the size
of the final binary, we remove them and instead emit STABS symbols for
`dsymutil` and the debugger to locate their contents in the object files.
With this diff, `dsymutil` is able to locate the debug info. However, we need
a few more features before `lldb` is able to work well with our binaries --
e.g. having `LC_DYSYMTAB` accurately reflect the number of local symbols,
emitting `LC_UUID`, and more. Those will be handled in follow-up diffs.
Note also that the STABS we emit differ slightly from what ld64 does. First, we
emit the path to the source file as one `N_SO` symbol instead of two. (`ld64`
emits one `N_SO` for the dirname and one of the basename.) Second, we do not
emit `N_BNSYM` and `N_ENSYM` STABS to mark the start and end of functions,
because the `N_FUN` STABS already serve that purpose. @clayborg recommended
these changes based on his knowledge of what the debugging tools look for.
Additionally, this current implementation doesn't accurately reflect the size
of function symbols. It uses the size of their containing sectioins as a proxy,
but that is only accurate if `.subsections_with_symbols` is set, and if there
isn't an `N_ALT_ENTRY` in that particular subsection. I think we have two
options to solve this:
1. We can split up subsections by symbol even if `.subsections_with_symbols`
is not set, but include constraints to ensure those subsections retain
their order in the final output. This is `ld64`'s approach.
2. We could just add a `size` field to our `Symbol` class. This seems simpler,
and I'm more inclined toward it, but I'm not sure if there are use cases
that it doesn't handle well. As such I'm punting on the decision for now.
Reviewed By: clayborg
Differential Revision: https://reviews.llvm.org/D89257
2020-12-02 06:45:01 +08:00
|
|
|
Dwarf.cpp
|
2020-04-30 06:42:19 +08:00
|
|
|
ExportTrie.cpp
|
2020-04-03 02:54:05 +08:00
|
|
|
InputFiles.cpp
|
|
|
|
InputSection.cpp
|
2020-10-27 10:18:29 +08:00
|
|
|
LTO.cpp
|
2020-05-02 07:29:06 +08:00
|
|
|
MergedOutputSection.cpp
|
2020-08-19 05:37:04 +08:00
|
|
|
ObjC.cpp
|
2020-05-02 07:29:06 +08:00
|
|
|
OutputSection.cpp
|
2020-04-03 02:54:05 +08:00
|
|
|
OutputSegment.cpp
|
2021-03-12 02:28:09 +08:00
|
|
|
Relocations.cpp
|
2020-04-03 02:54:05 +08:00
|
|
|
SymbolTable.cpp
|
|
|
|
Symbols.cpp
|
2020-04-22 04:37:57 +08:00
|
|
|
SyntheticSections.cpp
|
2020-04-03 02:54:05 +08:00
|
|
|
Target.cpp
|
2021-03-18 22:38:30 +08:00
|
|
|
MapFile.cpp
|
2020-04-03 02:54:05 +08:00
|
|
|
Writer.cpp
|
|
|
|
|
|
|
|
LINK_COMPONENTS
|
|
|
|
${LLVM_TARGETS_TO_BUILD}
|
|
|
|
BinaryFormat
|
2021-02-04 02:31:42 +08:00
|
|
|
BitReader
|
2020-04-03 02:54:05 +08:00
|
|
|
Core
|
2020-12-02 11:00:46 +08:00
|
|
|
DebugInfoDWARF
|
2020-10-27 10:18:29 +08:00
|
|
|
LTO
|
|
|
|
MC
|
2021-01-25 22:43:39 +08:00
|
|
|
ObjCARCOpts
|
2020-04-03 02:54:05 +08:00
|
|
|
Object
|
|
|
|
Option
|
2020-10-27 10:18:29 +08:00
|
|
|
Passes
|
2020-04-03 02:54:05 +08:00
|
|
|
Support
|
2020-06-09 04:12:58 +08:00
|
|
|
TextAPI
|
2020-04-03 02:54:05 +08:00
|
|
|
|
|
|
|
LINK_LIBS
|
|
|
|
lldCommon
|
|
|
|
${LLVM_PTHREAD_LIB}
|
|
|
|
|
|
|
|
DEPENDS
|
|
|
|
MachOOptionsTableGen
|
|
|
|
${tablegen_deps}
|
|
|
|
)
|