llvm-project/lld/MachO
Jez Ng 403d61aedd [lld-macho] Enable EH frame relocation / pruning
This just removes the code that gates the logic. The main issue here is
perf impact: without {D122258}, LLD takes a significant perf hit because
it now has to do a lot more work in the input parsing phase. But with
that change to eliminate unnecessary EH frames from input object files,
the perf overhead here is minimal. Concretely, here are the numbers for
some builds as measured on my 16-core Mac Pro:

**chromium_framework**

This is without the use of `-femit-dwarf-unwind=no-compact-unwind`:

             base           diff           difference (95% CI)
  sys_time   1.826 ± 0.019  1.962 ± 0.034  [  +6.5% ..   +8.4%]
  user_time  9.306 ± 0.054  9.926 ± 0.082  [  +6.2% ..   +7.1%]
  wall_time  8.225 ± 0.068  8.947 ± 0.128  [  +8.0% ..   +9.6%]
  samples    15             22

With that flag enabled, the regression mostly disappears, as hoped:

             base           diff           difference (95% CI)
  sys_time   1.839 ± 0.062  1.866 ± 0.068  [  -0.9% ..   +3.8%]
  user_time  9.452 ± 0.068  9.490 ± 0.067  [  -0.1% ..   +0.9%]
  wall_time  8.383 ± 0.127  8.452 ± 0.114  [  -0.1% ..   +1.8%]
  samples    17             21

**Unnamed internal app**

Without `-femit-dwarf-unwind`, this is the perf hit:

             base           diff           difference (95% CI)
  sys_time   1.372 ± 0.029  1.317 ± 0.024  [  -4.6% ..   -3.5%]
  user_time  2.835 ± 0.028  2.980 ± 0.027  [  +4.8% ..   +5.4%]
  wall_time  3.205 ± 0.079  3.383 ± 0.066  [  +4.9% ..   +6.2%]
  samples    102            83

With `-femit-dwarf-unwind`, the perf hit almost disappears:

             base           diff           difference (95% CI)
  sys_time   1.274 ± 0.026  1.270 ± 0.025  [  -0.9% ..   +0.3%]
  user_time  2.812 ± 0.023  2.822 ± 0.035  [  +0.1% ..   +0.7%]
  wall_time  3.166 ± 0.047  3.174 ± 0.059  [  -0.2% ..   +0.7%]
  samples    95             97

Just for fun, I measured the impact of `-femit-dwarf-unwind` on ld64
(`base` has the extra DWARF unwind info in the input object files,
`diff` doesn't):

             base           diff           difference (95% CI)
  sys_time   1.128 ± 0.010  1.124 ± 0.023  [  -1.3% ..   +0.6%]
  user_time  7.176 ± 0.030  7.106 ± 0.094  [  -1.5% ..   -0.4%]
  wall_time  7.874 ± 0.041  7.795 ± 0.121  [  -1.7% ..   -0.3%]
  samples    16             25

And for LLD:

             base           diff           difference (95% CI)
  sys_time   1.315 ± 0.019  1.280 ± 0.019  [  -3.2% ..   -2.0%]
  user_time  2.980 ± 0.022  2.822 ± 0.016  [  -5.5% ..   -5.0%]
  wall_time  3.369 ± 0.038  3.175 ± 0.033  [  -6.2% ..   -5.3%]
  samples    47             47

So parsing the extra EH frames is a lot more expensive for us than for
ld64. But given that we are quite a lot faster than ld64 to begin with,
I guess this isn't entirely unexpected...

Reviewed By: #lld-macho, oontvoo

Differential Revision: https://reviews.llvm.org/D129540
2022-07-13 21:14:05 -04:00
..
Arch [lld-macho] Add LOH_ARM64_ADRP_LDR_GOT_LDR optimization hint support 2022-07-13 12:20:14 +02:00
CMakeLists.txt [lld-macho][reland] Initial support for EH Frames 2022-06-13 07:45:16 -04:00
ConcatOutputSection.cpp Replace to_hexString by touhexstr [NFC] 2022-06-16 17:29:50 +02:00
ConcatOutputSection.h [lld-macho][nfc] Give non-text ConcatOutputSections order-independent finalization 2022-04-07 18:13:27 -04:00
Config.h [lld-macho] Enable EH frame relocation / pruning 2022-07-13 21:14:05 -04:00
Driver.cpp [lld-macho] Enable EH frame relocation / pruning 2022-07-13 21:14:05 -04:00
Driver.h [lld/mac] For catalyst outputs, tolerate implicitly linking against mac-only tbd files 2022-04-23 21:43:46 -04:00
DriverUtils.cpp [lld-macho] Add support for -w 2022-06-11 17:38:50 -07:00
Dwarf.cpp Reland "[lld-macho] Show source information for undefined references" 2022-06-21 18:50:06 -04:00
Dwarf.h Reland "[lld-macho] Show source information for undefined references" 2022-06-21 18:50:06 -04:00
EhFrame.cpp [lld-macho][reland] Initial support for EH Frames 2022-06-13 07:45:16 -04:00
EhFrame.h [lld-macho][reland] Initial support for EH Frames 2022-06-13 07:45:16 -04:00
ExportTrie.cpp Reland "[lld-macho] Avoid using bump-alloc in TrieBuider"" 2022-03-14 19:33:13 -04:00
ExportTrie.h Reland "[lld-macho] Avoid using bump-alloc in TrieBuider"" 2022-03-14 19:33:13 -04:00
ICF.cpp [lld/mac] Add a few TimeTraceScopes 2022-06-23 11:46:57 -04:00
ICF.h [lld] Implement safe icf for MachO 2022-05-03 21:01:03 -04:00
InputFiles.cpp [lld-macho] Enable EH frame relocation / pruning 2022-07-13 21:14:05 -04:00
InputFiles.h [lld-macho] Accept dylibs with LC_DYLD_EXPORTS_TRIE 2022-07-13 22:34:11 +02:00
InputSection.cpp [lld-macho] Handle user-provided dtrace symbols to avoid linking failure 2022-07-11 15:32:26 -04:00
InputSection.h [lld-macho] Initial support for Linker Optimization Hints 2022-06-30 06:28:42 +02:00
LTO.cpp [lld-macho] Make `--icf=safe` work with LTO 2022-06-12 17:26:08 -04:00
LTO.h [lld-macho] Add LTO cache support 2021-07-15 12:56:13 -04:00
MachOStructs.h [lld-macho] Add support for arm64_32 2021-04-15 21:16:33 -04:00
MapFile.cpp Rename parallelForEachN to just parallelFor 2022-06-19 17:49:00 -04:00
MapFile.h [lld-macho] implement options -map 2021-03-18 10:39:19 -04:00
MarkLive.cpp [lld-macho][nfc] Run clang-format on lld/MachO/*.{h,cpp} 2022-05-24 08:36:20 +07:00
MarkLive.h [lld/mac] Implement -dead_strip 2021-06-02 11:09:26 -04:00
ObjC.cpp [lld/macho] Fixes the -ObjC flag 2022-05-11 17:00:39 -07:00
ObjC.h [lld-macho] Implement -ObjC 2020-08-26 19:20:55 -07:00
Options.td [lld-macho] Initial support for Linker Optimization Hints 2022-06-30 06:28:42 +02:00
OutputSection.cpp [lld-macho][nfc] Run clang-format on lld/MachO/*.{h,cpp} 2022-05-24 08:36:20 +07:00
OutputSection.h [lld-macho][nfc] Comments and style fixes 2022-02-01 13:45:59 -05:00
OutputSegment.cpp [MachO] Properly reset global state 2021-10-31 16:14:29 -07:00
OutputSegment.h [MachO] Properly reset global state 2021-10-31 16:14:29 -07:00
Relocations.cpp [lld-macho] Have relocation address included in range-check error message 2022-02-28 21:56:38 -05:00
Relocations.h [lld-macho] Initial support for Linker Optimization Hints 2022-06-30 06:28:42 +02:00
SectionPriorities.cpp [lld] Don't use Optional::hasValue (NFC) 2022-06-26 19:37:14 -07:00
SectionPriorities.h [lld-macho][NFC] Encapsulate symbol priority implementation. 2022-03-31 13:47:38 -04:00
SymbolTable.cpp [lld-macho] Handle user-provided dtrace symbols to avoid linking failure 2022-07-11 15:32:26 -04:00
SymbolTable.h Reland "[lld-macho] Group undefined symbol diagnostics by symbol". 2022-06-15 19:22:39 -04:00
Symbols.cpp [lld-macho] Use source information in duplicate symbol errors 2022-06-23 11:07:15 -04:00
Symbols.h [lld-macho] Use source information in duplicate symbol errors 2022-06-23 11:07:15 -04:00
SyntheticSections.cpp [lld-macho] Emit REBASE_OPCODE_ADD_ADDR_IMM_SCALED if possible 2022-06-29 22:28:39 +02:00
SyntheticSections.h Reland "[lld-macho] Show source information for undefined references" 2022-06-21 18:50:06 -04: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] Handle user-provided dtrace symbols to avoid linking failure 2022-07-11 15:32:26 -04:00
UnwindInfoSection.cpp [lld-macho] Fix compact unwind output for 32 bit builds 2022-07-11 08:21:03 +00:00
UnwindInfoSection.h [lld-macho][nfc] De-templatize UnwindInfoSection 2022-04-13 16:19:22 -04:00
Writer.cpp [lld/mac] Add a few TimeTraceScopes 2022-06-23 11:46:57 -04:00
Writer.h [MachO] Properly reset global state 2021-10-31 16:14:29 -07:00
ld64-vs-lld.rst [lld-macho][nfc] Fix formatting in ld64-vs-lld.rst 2022-03-10 18:33:18 -05:00