This is an archive of the discontinued LLVM Phabricator instance.

[libunwind] Don't use dl_iterate_phdr if __ANDROID_API__ < 21
ClosedPublic

Authored by thomasanderson on Oct 31 2017, 1:01 PM.

Diff Detail

Event Timeline

thomasanderson created this revision.Oct 31 2017, 1:01 PM
danalbert requested changes to this revision.Oct 31 2017, 1:25 PM

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.

This revision now requires changes to proceed.Oct 31 2017, 1:25 PM

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.

thomasanderson edited edge metadata.

Add fallback to dl_unwind_find_exidx

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

danalbert accepted this revision.Oct 31 2017, 2:36 PM

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!

This revision is now accepted and ready to land.Oct 31 2017, 2:36 PM
This revision was automatically updated to reflect the committed changes.