[all-commits] [llvm/llvm-project] 002eda: [lld-macho] Associate compact unwind entries with ...

Jez Ng via All-commits all-commits at lists.llvm.org
Tue Oct 26 13:04:54 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 002eda7056af54cf16caabbce4d1d39e860fbaaf
      https://github.com/llvm/llvm-project/commit/002eda7056af54cf16caabbce4d1d39e860fbaaf
  Author: Jez Ng <jezng at fb.com>
  Date:   2021-10-26 (Tue, 26 Oct 2021)

  Changed paths:
    M lld/MachO/ConcatOutputSection.cpp
    M lld/MachO/Driver.cpp
    M lld/MachO/ICF.cpp
    M lld/MachO/InputFiles.cpp
    M lld/MachO/InputFiles.h
    M lld/MachO/InputSection.cpp
    M lld/MachO/InputSection.h
    M lld/MachO/MarkLive.cpp
    M lld/MachO/SymbolTable.cpp
    M lld/MachO/Symbols.cpp
    M lld/MachO/Symbols.h
    M lld/MachO/SyntheticSections.cpp
    M lld/MachO/UnwindInfoSection.cpp
    M lld/MachO/UnwindInfoSection.h
    M lld/MachO/Writer.cpp
    M lld/test/MachO/compact-unwind-both-local-and-dylib-personality.s
    M lld/test/MachO/dead-strip.s
    M lld/test/MachO/invalid/cfstring.s

  Log Message:
  -----------
  [lld-macho] Associate compact unwind entries with function symbols

Compact unwind entries (CUEs) contain pointers to their respective
function symbols. However, during the link process, it's far more useful
to have pointers from the function symbol to the CUE than vice versa.
This diff adds that pointer in the form of `Defined::compactUnwind`.

In particular, when doing dead-stripping, we want to mark CUEs live when
their function symbol is live; and when doing ICF, we want to dedup
sections iff the symbols in that section have identical CUEs. In both
cases, we want to be able to locate the symbols within a given section,
as well as locate the CUEs belonging to those symbols. So this diff also
adds `InputSection::symbols`.

The ultimate goal of this refactor is to have ICF support dedup'ing
functions with unwind info, but that will be handled in subsequent
diffs. This diff focuses on simplifying `-dead_strip` --
`findFunctionsWithUnwindInfo` is no longer necessary, and
`Defined::isLive()` is now a lot simpler. Moreover, UnwindInfoSection no
longer has to check for dead CUEs -- we simply avoid adding them in the
first place.

Additionally, we now support stripping of dead LSDAs, which follows
quite naturally since `markLive()` can now reach them via the CUEs.

Reviewed By: #lld-macho, gkm

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


  Commit: a9353dbe517c522ac63818de2cde645acdc46834
      https://github.com/llvm/llvm-project/commit/a9353dbe517c522ac63818de2cde645acdc46834
  Author: Jez Ng <jezng at fb.com>
  Date:   2021-10-26 (Tue, 26 Oct 2021)

  Changed paths:
    M lld/MachO/UnwindInfoSection.cpp
    M lld/MachO/UnwindInfoSection.h
    M lld/MachO/Writer.cpp

  Log Message:
  -----------
  [lld-macho] Simplify the handling of "no unwind info" functions

This diff does away with `addEntriesForFunctionsWithoutUnwindInfo()`,
because `addSymbol()` can now determine which functions need those
entries.

While overhauling UnwindInfoSection, I also parallelized the relocation
of the contents of the CUEs. This somewhat offsets the time regression
from creating one InputSection per CUE (which was done in D109944).

Reviewed By: #lld-macho, oontvoo

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


Compare: https://github.com/llvm/llvm-project/compare/4faf88cc146b...a9353dbe517c


More information about the All-commits mailing list