[libunwind] Replace chain-of-ifdefs for dl_iterate_phdr

Define a _LIBUNWIND_USE_DL_ITERATE_PHDR macro in config.h when there is
no other unwind info lookup method. Also define a
_LIBUNWIND_USE_DL_UNWIND_FIND_EXIDX macro to factor out
(__BIONIC__ and _LIBUNWIND_ARM_EHABI).

Differential Revision: https://reviews.llvm.org/D86768

Cr-Mirrored-From: https://chromium.googlesource.com/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 88bf133c99c3124842c182a019306f83f2c1b856
diff --git a/test/frameheadercache_test.pass.cpp b/test/frameheadercache_test.pass.cpp
index ebbc004..7f2d8e2 100644
--- a/test/frameheadercache_test.pass.cpp
+++ b/test/frameheadercache_test.pass.cpp
@@ -3,27 +3,10 @@
 #include "../src/config.h"
 
 // Only run this test under supported configurations.
-// The frame header cache should work fine for other architectures,
-// but the #ifdefs end up being even more complicated than this.
 
-#if defined(__x86_64__) && defined(_LIBUNWIND_USE_FRAME_HEADER_CACHE)
-
-// This #if chain is ugly, but see the comments in AddressSpace.hpp for
-// the reasoning.
-
-#ifdef __APPLE__
-int main() { return 0; }
-#elif defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) && defined(_LIBUNWIND_IS_BAREMETAL)
-int main() { return 0; }
-#elif defined(_LIBUNWIND_ARM_EHABI) && defined(_LIBUNWIND_IS_BAREMETAL)
-int main() { return 0; }
-#elif defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) && defined(_WIN32)
-int main() { return 0; }
-#elif defined(_LIBUNWIND_SUPPORT_SEH_UNWIND) && defined(_WIN32)
-int main() { return 0; }
-#elif defined(_LIBUNWIND_ARM_EHABI) && defined(__BIONIC__)
-int main() { return 0; }
-#elif defined(_LIBUNWIND_ARM_EHABI) || defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
+#if defined(_LIBUNWIND_USE_DL_ITERATE_PHDR) &&                                 \
+    defined(_LIBUNWIND_SUPPORT_DWARF_INDEX) &&                                 \
+    defined(_LIBUNWIND_USE_FRAME_HEADER_CACHE)
 
 #include <link.h>
 #include <stdio.h>
@@ -84,9 +67,7 @@
     abort();
   return 0;
 }
-#else
-int main() { return 0; }
-#endif
+
 #else
 int main() { return 0;}
 #endif