HomePhabricator

[lld/mac] Don't crash when dead-stripping removes all unwind info

Authored by thakis on Jul 7 2021, 8:28 AM.

Description

[lld/mac] Don't crash when dead-stripping removes all unwind info

If the input has compact unwind info but all of it is removed
after dead stripping, we would crash. Now we don't write any
__unwind_info section at all, like ld64.

This is a bit awkward to implement because we only know the final
state of unwind info after UnwindInfoSectionImpl<Ptr>::finalize(),
which is called after sections are added. So add a small amount of
bookkeeping to relocateCompactUnwind() instead (which runs earlier)
so that we can predict what finalize() will do before it runs.

Fixes PR51010.

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

Details

Committed
thakisJul 7 2021, 10:05 AM
Differential Revision
D105557: [lld/mac] Don't crash when dead-stripping removes all unwind info
Parents
rGd4cb286b05f5: [NFC][lldb-vscode] Fix launch test
Branches
Unknown
Tags
Unknown