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

Authored by int3 on Oct 26 2021, 1:04 PM.


[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


int3Oct 26 2021, 1:04 PM
Restricted Project
Differential Revision
D109944: [lld-macho] Associate compact unwind entries with function symbols
rG4faf88cc146b: [InstCombine] Precommit new and-xor-or.ll tests. NFC.