llvm-project/lld/MachO
Greg McGary f27e4548fc [lld-macho] Implement ICF
ICF = Identical C(ode|OMDAT) Folding

This is the LLD ELF/COFF algorithm, adapted for MachO. So far, only `-icf all` is supported. In order to support `-icf safe`, we will need to port address-significance tables (`.addrsig` directives) to MachO, which will come in later diffs.

`check-{llvm,clang,lld}` have 0 regressions for `lld -icf all` vs. baseline ld64.

We only run ICF on `__TEXT,__text` for reasons explained in the block comment in `ConcatOutputSection.cpp`.

Here is the perf impact for linking `chromium_framekwork` on a Mac Pro (16-core Xeon W) for the non-ICF case vs. pre-ICF:
```
    N           Min           Max        Median           Avg        Stddev
x  20          4.27          4.44          4.34         4.349   0.043029977
+  20          4.37          4.46         4.405        4.4115   0.025188761
Difference at 95.0% confidence
        0.0625 +/- 0.0225658
        1.43711% +/- 0.518873%
        (Student's t, pooled s = 0.0352566)
```

Reviewed By: #lld-macho, int3

Differential Revision: https://reviews.llvm.org/D103292
2021-06-17 10:07:44 -07:00
..
Arch [lld-macho] Implement branch-range-extension thunks 2021-05-12 09:44:58 -07:00
CMakeLists.txt [lld-macho] Implement ICF 2021-06-17 10:07:44 -07:00
ConcatOutputSection.cpp [lld-macho] Implement ICF 2021-06-17 10:07:44 -07:00
ConcatOutputSection.h [lld-macho] Implement ICF 2021-06-17 10:07:44 -07:00
Config.h [lld-macho] Implement ICF 2021-06-17 10:07:44 -07:00
Driver.cpp [lld-macho] Implement ICF 2021-06-17 10:07:44 -07:00
Driver.h [lld/mac] Print dylib search details with --print-dylib-search or RC_TRACE_DYLIB_SEARCHING 2021-06-09 22:08:20 -04:00
DriverUtils.cpp [lld/mac] Print dylib search details with --print-dylib-search or RC_TRACE_DYLIB_SEARCHING 2021-06-09 22:08:20 -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
ICF.cpp [lld-macho] Implement ICF 2021-06-17 10:07:44 -07:00
ICF.h [lld-macho] Implement ICF 2021-06-17 10:07:44 -07:00
InputFiles.cpp [lld-macho] Implement ICF 2021-06-17 10:07:44 -07:00
InputFiles.h [lld][MachO] Add support for LC_DATA_IN_CODE 2021-06-14 19:21:59 -07:00
InputSection.cpp [lld-macho] Implement ICF 2021-06-17 10:07:44 -07:00
InputSection.h [lld-macho] Implement ICF 2021-06-17 10:07:44 -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][MachO] Sort symbols in parallel in -map 2021-06-17 10:19:59 +08:00
MapFile.h [lld-macho] implement options -map 2021-03-18 10:39:19 -04:00
MarkLive.cpp [lld-macho] Have dead-stripping work with literal sections 2021-06-11 19:50:09 -04:00
MarkLive.h [lld/mac] Implement -dead_strip 2021-06-02 11:09:26 -04: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 ICF 2021-06-17 10:07:44 -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][nfc] Sort OutputSections based on explicit order of command-line inputs 2021-05-25 14:58:29 -04:00
OutputSegment.cpp [lld-macho] Put DATA_IN_CODE immediately after FUNCTION_STARTS 2021-06-16 15:23:07 -04:00
OutputSegment.h [lld] Add missing includes (NFC) 2021-06-03 18:55:18 +02: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][nfc] Move liveness-tracking fields into ConcatInputSection 2021-06-11 19:50:08 -04:00
SymbolTable.h [lld/mac] Implement -dead_strip 2021-06-02 11:09:26 -04:00
Symbols.cpp [lld-macho] Implement ICF 2021-06-17 10:07:44 -07:00
Symbols.h [lld-macho][nfc] Remove InputSection::outSecFileOff 2021-06-13 19:51:30 -04:00
SyntheticSections.cpp [lld-macho] Implement ICF 2021-06-17 10:07:44 -07:00
SyntheticSections.h [lld][MachO] Add support for LC_DATA_IN_CODE 2021-06-14 19:21:59 -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-macho] Implement ICF 2021-06-17 10:07:44 -07:00
UnwindInfoSection.h [lld-macho] Implement ICF 2021-06-17 10:07:44 -07:00
Writer.cpp [lld-macho] Implement ICF 2021-06-17 10:07:44 -07:00
Writer.h [lld-macho] De-templatize mach_header operations 2021-05-03 18:31:23 -04:00