On ARM, dl_iterate_phdr is only implemented in the Android NDK version 21 or later:
https://android.googlesource.com/platform/prebuilts/ndk/+/dev/platform/sysroot/usr/include/link.h#55
Details
Diff Detail
Event Timeline
Doesn't this just turn a build failure into a runtime failure? There are no more fallback implementations after this one. After this change the function will just return false and it will fail to find any unwind sections.
Oh yeah, that's correct. But some Android systems don't have dl_iterate_phdr in their libc, so I'm not sure how to get libc++/libc++abi/libunwind working with them.
danalbert@ Turns out those versions of the ndk have dl_unwind_find_exidx on ARM, which does what we want -- added this in the latest patch set
But some Android systems don't have dl_iterate_phdr in their libc, so I'm not sure how to get libc++/libc++abi/libunwind working with them.
The NDK is on an older version of libunwind from before dl_iterate_phdr was required. Looks like that changed with https://reviews.llvm.org/D28082, which removed essentially the block of code you've now added. You're putting it back in such a way that it only affects Android targets that can't use dl_iterate_phdr, so LGTM. Thanks for fixing this!