[libcxx-commits] [PATCH] D86256: [libunwind] Refactor DWARF FDE lookup

Ryan Prichard via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 19 17:21:03 PDT 2020


rprichard created this revision.
rprichard added reviewers: saugustine, jgorbe, mstorsjo, compnerd.
Herald added subscribers: libcxx-commits, llvm-commits, kristof.beyls, aprantl.
Herald added projects: LLVM, libunwind.
Herald added a reviewer: libunwind.
rprichard requested review of this revision.

Add another macro, _LIBUNWIND_SUPPORT_DWARF_SECTION, that indicates
that the location and length of .eh_frame is known, and that .eh_frame
should be scanned to find an FDE. When the unwinder can search
.eh_frame_hdr, it generally doesn't need to scan .eh_frame, and when it
finds the index via PT_GNU_EH_FRAME, it doesn't know the length of
.eh_frame. When we use dl_iterate_phdr, we also don't want to add an
entry to the DwarfFDECache, because the entry won't be removed if a
module is unloaded.

For a bare-metal target, the location of both .eh_frame and
.eh_frame_hdr is known, but maybe the .eh_frame_hdr is unused/empty,
so enable both methods. .eh_frame is only scanned if the index is
unavailable.

Replace a chain-of-ifdefs in a couple of places by defining a
_LIBUNWIND_USE_DL_ITERATE_PHDR macro in config.h. I also define a
_LIBUNWIND_USE_DL_UNWIND_FIND_EXIDX macro to factor out
(_LIBUNWIND_ARM_EHABI and __BIONIC__).

Fix the calculation of ehSectionEnd in CFI_Parser<A>::findFDE.

Minor change: Stop defining the ElfW macro for _WIN32.

This change fixes:

- https://bugs.llvm.org/show_bug.cgi?id=36005
- https://bugs.llvm.org/show_bug.cgi?id=46829


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86256

Files:
  libunwind/src/AddressSpace.hpp
  libunwind/src/DwarfParser.hpp
  libunwind/src/FrameHeaderCache.hpp
  libunwind/src/UnwindCursor.hpp
  libunwind/src/config.h
  libunwind/test/frameheadercache_test.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86256.286692.patch
Type: text/x-patch
Size: 25585 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200820/61c4cd20/attachment-0001.bin>


More information about the libcxx-commits mailing list