[all-commits] [llvm/llvm-project] bcaf57: [lld-macho] Parse relocations quickly by assuming ...

Jez Ng via All-commits all-commits at lists.llvm.org
Sun Jul 4 22:14:56 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bcaf57cae82500f40f2348f5ee41e57b11152825
      https://github.com/llvm/llvm-project/commit/bcaf57cae82500f40f2348f5ee41e57b11152825
  Author: Jez Ng <jezng at fb.com>
  Date:   2021-07-05 (Mon, 05 Jul 2021)

  Changed paths:
    M lld/MachO/ConcatOutputSection.cpp
    M lld/MachO/InputFiles.cpp
    A lld/test/MachO/unsorted-relocations.yaml

  Log Message:
  -----------
  [lld-macho] Parse relocations quickly by assuming sorted order

clang and gcc both seem to emit relocations in reverse order of
address. That means we can match relocations to their containing
subsections in `O(relocs + subsections)` rather than the `O(relocs *
log(subsections))` that our previous binary search implementation
required.

Unfortunately, `ld -r` can still emit unsorted relocations, so we have a
fallback code path for that (less common) case.

Numbers for linking chromium_framework on my 3.2 GHz 16-Core Intel Xeon W:

      N           Min           Max        Median           Avg        Stddev
  x  20          4.04          4.11         4.075        4.0775   0.018027756
  +  20          3.95          4.02          3.98         3.985   0.020900768
  Difference at 95.0% confidence
          -0.0925 +/- 0.0124919
          -2.26855% +/- 0.306361%
          (Student's t, pooled s = 0.0195172)

Reviewed By: #lld-macho, thakis

Differential Revision: https://reviews.llvm.org/D105410




More information about the All-commits mailing list