Page MenuHomePhabricator

[libunwind][Android] Fix findUnwindSections for ARM EHABI Bionic

Authored by rprichard on Oct 15 2019, 12:37 AM.



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.)

Diff Detail

Event Timeline

rprichard created this revision.Oct 15 2019, 12:37 AM

FWIW, I tested the "extest" benchmark from on arm32. Using dl_unwind_find_exidx, the benchmark throws 10,000 exceptions in about 860ms. Using dl_iterate_phdr, the run-time varies, and I saw run-times from 3000-6000ms. (The unwinder has an optimization where it compares dlpi_addr to the target PC, and that makes EH overhead depend on the layout of shared libraries in memory.)

danalbert accepted this revision.Oct 15 2019, 9:13 PM
This revision is now accepted and ready to land.Oct 15 2019, 9:13 PM
srhines accepted this revision.Oct 17 2019, 3:13 PM
This revision was automatically updated to reflect the committed changes.