unstick r375275

Revision 375275

Date:
2019/10/18 19:59:22
Author:
rprichard
Revision Log:
[libunwind][Android] Fix findUnwindSections for ARM EHABI Bionic

Summary:
Fix the arm_section_length count. The meaning of the arm_section_length
field changed from num-of-elements to num-of-bytes when the
dl_unwind_find_exidx special case was removed (D30306 and D30681). The
special case was restored in D39468, but that patch didn't account for the
change in arm_section_length's meaning.

That patch worked when it was applied to the NDK's fork of libunwind,
because it never removed the special case in the first place, and the
special case is probably disabled in the Android platform's copy of
libunwind, because __ANDROID_API__ is greater than 21.

Turn the dl_unwind_find_exidx special case on unconditionally for Bionic.
Bionic's dl_unwind_find_exidx is much faster than using dl_iterate_phdr.
(e.g. Bionic stores exidx info on an internal soinfo object.)

Reviewers: thomasanderson, srhines, danalbert, ed, keith.walker.arm, mclow.lists, compnerd

Reviewed By: srhines, danalbert

Subscribers: srhines, kristof.beyls, christof, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D68972
Files:

Legend:

 
Added
 
Removed
 
Modified
  • libunwind/trunk/src/AddressSpace.hpp

     
    32 32 #endif
    33 33 #endif
    34 34
    35 #if defined(_LIBUNWIND_ARM_EHABI)
    36 struct EHABIIndexEntry {
    37 uint32_t functionOffset;
    38 uint32_t data;
    39 };
    40 #endif
    41
    35 42 #ifdef __APPLE__
    36 43 #include <mach-o/getsect.h>
    37 44 namespace libunwind {
     
    462 469 (void)targetAddr;
    463 470 (void)info;
    464 471 return true;
    465 #elif defined(_LIBUNWIND_ARM_EHABI) && defined(__BIONIC__) && \
    466 (__ANDROID_API__ < 21)
    472 #elif defined(_LIBUNWIND_ARM_EHABI) && defined(__BIONIC__)
    473 // For ARM EHABI, Bionic didn't implement dl_iterate_phdr until API 21. After
    474 // API 21, dl_iterate_phdr exists, but dl_unwind_find_exidx is much faster.
    467 475 int length = 0;
    468 476 info.arm_section =
    469 477 (uintptr_t)dl_unwind_find_exidx((_Unwind_Ptr)targetAddr, &length);
    470 info.arm_section_length = (uintptr_t)length;
    478 info.arm_section_length = (uintptr_t)length * sizeof(EHABIIndexEntry);
    471 479 if (info.arm_section && info.arm_section_length)
    472 480 return true;
    473 481 #elif defined(_LIBUNWIND_ARM_EHABI) || defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
  • libunwind/trunk/src/UnwindCursor.hpp

     
    1222 1222 #endif // defined(_LIBUNWIND_SUPPORT_SEH_UNWIND)
    1223 1223
    1224 1224 #if defined(_LIBUNWIND_ARM_EHABI)
    1225 struct EHABIIndexEntry {
    1226 uint32_t functionOffset;
    1227 uint32_t data;
    1228 };
    1229
    1230 1225 template<typename A>
    1231 1226 struct EHABISectionIterator {
    1232 1227 typedef EHABISectionIterator _Self;