[libunwind] Combine dl_iterate_phdr codepaths for DWARF and EHABI
authorRyan Prichard <rprichard@google.com>
Wed, 23 Sep 2020 21:25:13 +0000 (14:25 -0700)
committerRyan Prichard <rprichard@google.com>
Wed, 23 Sep 2020 22:40:39 +0000 (15:40 -0700)
commitb16d6653c01cee37f51a98dd4092c4ef302c47a5
tree24cd9e5ee0ba77544fb9b160cd28d2f3c5bd0ed3
parent38de1c33a8374bb16abfb024a973d851c170bafc
[libunwind] Combine dl_iterate_phdr codepaths for DWARF and EHABI

dl_iterate_phdr is used to search for unwind info provided by either
PT_GNU_EH_FRAME or PT_ARM_EXIDX. Most of the code between the two is
the same, so combine them, and factor out what's different into
checkForUnwindInfoSegment.

Details:
 - The FrameHeaderCache can now be enabled for ARM EHABI.
 - findUnwindSectionsByPhdr now finds the last PT_ARM_EXIDX rather than
   the first. There should only be one segment.
 - The dso_base and text_segment_length fields of UnwindInfoSections
   are now needed for dl_iterate_phdr when using EHABI, to hold the
   low and high PC values for a cache entry.

Reviewed By: compnerd, danielkiss, #libunwind, saugustine

Differential Revision: https://reviews.llvm.org/D87880
libunwind/src/AddressSpace.hpp
libunwind/test/frameheadercache_test.pass.cpp