[all-commits] [llvm/llvm-project] 8a7b5e: [lld/mac] Don't crash when dead-stripping removes ...

Nico Weber via All-commits all-commits at lists.llvm.org
Wed Jul 7 10:06:05 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8a7b5ebf4d8fd5f4cfe1daf72e0e58df7f716e4c
      https://github.com/llvm/llvm-project/commit/8a7b5ebf4d8fd5f4cfe1daf72e0e58df7f716e4c
  Author: Nico Weber <thakis at chromium.org>
  Date:   2021-07-07 (Wed, 07 Jul 2021)

  Changed paths:
    M lld/MachO/UnwindInfoSection.cpp
    M lld/MachO/UnwindInfoSection.h
    M lld/test/MachO/compact-unwind.s

  Log Message:
  -----------
  [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




More information about the All-commits mailing list