Break libdl.so and ld-android.so's dependency on libc.so.

 * Specify "nocrt: true" to avoid calling __cxa_finalize.

 * Define a dummy __aeabi_unwind_cpp_pr0 for arm32.

Bug: b/62815515
Bug: b/73873002
Test: boot AOSP hikey960-userdebug
Test: run ndk_cxa_example in special /system/bin/debug namespace
Test: run Bionic unit tests
Change-Id: I59bcb100a2753286b59c51a47d7a183507219a07
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index 84f525d..7d9abf9 100644
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
@@ -1438,7 +1438,8 @@
 #define DT_ANDROID_RELA (llvm::ELF::DT_LOOS + 4)
 
 template<typename ELFT>
-void validate_compatibility_of_native_library(const std::string& path, ELFT* elf) {
+void validate_compatibility_of_native_library(const std::string& soname,
+                                              const std::string& path, ELFT* elf) {
   bool has_elf_hash = false;
   bool has_android_rel = false;
   bool has_rel = false;
@@ -1464,10 +1465,14 @@
 
   ASSERT_TRUE(has_elf_hash) << path.c_str() << ": missing elf hash (DT_HASH)";
   ASSERT_TRUE(!has_android_rel) << path.c_str() << ": has packed relocations";
-  ASSERT_TRUE(has_rel) << path.c_str() << ": missing DT_REL/DT_RELA";
+  // libdl.so is simple enough that it might not have any relocations, so
+  // exempt it from the DT_REL/DT_RELA check.
+  if (soname != "libdl.so") {
+    ASSERT_TRUE(has_rel) << path.c_str() << ": missing DT_REL/DT_RELA";
+  }
 }
 
-void validate_compatibility_of_native_library(const char* soname) {
+void validate_compatibility_of_native_library(const std::string& soname) {
   // On the systems with emulation system libraries would be of different
   // architecture.  Try to use alternate paths first.
   std::string path = std::string(ALTERNATE_PATH_TO_SYSTEM_LIB) + soname;
@@ -1487,7 +1492,7 @@
 
   ASSERT_TRUE(elf != nullptr);
 
-  validate_compatibility_of_native_library(path, elf);
+  validate_compatibility_of_native_library(soname, path, elf);
 }
 
 // This is a test for app compatibility workaround for arm apps