[libunwind] r375275 - [libunwind][Android] Fix findUnwindSections for ARM EHABI Bionic
Ryan Prichard via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 18 12:59:22 PDT 2019
Author: rprichard
Date: Fri Oct 18 12:59:22 2019
New Revision: 375275
URL: http://llvm.org/viewvc/llvm-project?rev=375275&view=rev
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
Modified:
libunwind/trunk/src/AddressSpace.hpp
libunwind/trunk/src/UnwindCursor.hpp
Modified: libunwind/trunk/src/AddressSpace.hpp
URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/AddressSpace.hpp?rev=375275&r1=375274&r2=375275&view=diff
==============================================================================
--- libunwind/trunk/src/AddressSpace.hpp (original)
+++ libunwind/trunk/src/AddressSpace.hpp Fri Oct 18 12:59:22 2019
@@ -32,6 +32,13 @@
#endif
#endif
+#if defined(_LIBUNWIND_ARM_EHABI)
+struct EHABIIndexEntry {
+ uint32_t functionOffset;
+ uint32_t data;
+};
+#endif
+
#ifdef __APPLE__
#include <mach-o/getsect.h>
namespace libunwind {
@@ -462,12 +469,13 @@ inline bool LocalAddressSpace::findUnwin
(void)targetAddr;
(void)info;
return true;
-#elif defined(_LIBUNWIND_ARM_EHABI) && defined(__BIONIC__) && \
- (__ANDROID_API__ < 21)
+#elif defined(_LIBUNWIND_ARM_EHABI) && defined(__BIONIC__)
+ // For ARM EHABI, Bionic didn't implement dl_iterate_phdr until API 21. After
+ // API 21, dl_iterate_phdr exists, but dl_unwind_find_exidx is much faster.
int length = 0;
info.arm_section =
(uintptr_t)dl_unwind_find_exidx((_Unwind_Ptr)targetAddr, &length);
- info.arm_section_length = (uintptr_t)length;
+ info.arm_section_length = (uintptr_t)length * sizeof(EHABIIndexEntry);
if (info.arm_section && info.arm_section_length)
return true;
#elif defined(_LIBUNWIND_ARM_EHABI) || defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
Modified: libunwind/trunk/src/UnwindCursor.hpp
URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindCursor.hpp?rev=375275&r1=375274&r2=375275&view=diff
==============================================================================
--- libunwind/trunk/src/UnwindCursor.hpp (original)
+++ libunwind/trunk/src/UnwindCursor.hpp Fri Oct 18 12:59:22 2019
@@ -1222,11 +1222,6 @@ template <typename A, typename R> bool U
#endif // defined(_LIBUNWIND_SUPPORT_SEH_UNWIND)
#if defined(_LIBUNWIND_ARM_EHABI)
-struct EHABIIndexEntry {
- uint32_t functionOffset;
- uint32_t data;
-};
-
template<typename A>
struct EHABISectionIterator {
typedef EHABISectionIterator _Self;
More information about the cfe-commits
mailing list