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

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 7 08:38:54 PDT 2021


thakis created this revision.
thakis added a reviewer: lld-macho.
Herald added a reviewer: int3.
Herald added a reviewer: gkm.
Herald added a project: lld-macho.
thakis requested review of this revision.

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.


https://reviews.llvm.org/D105557

Files:
  lld/MachO/UnwindInfoSection.cpp
  lld/MachO/UnwindInfoSection.h
  lld/test/MachO/compact-unwind.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105557.356977.patch
Type: text/x-patch
Size: 3855 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210707/288f1292/attachment.bin>


More information about the llvm-commits mailing list