Clean up linker architecture macros.
We don't need our own architecture macros; the standard ones will do.
This patch also fixes some __x86_64__ tests to be USE_RELA tests instead,
because they're not actually x86_64-specific.
I've cleaned up architecture-specific code slightly so where possible
all the code corresponding to a particular architecture is together.
This patch also fixes a bug in LP64 DT_PLTGOT handling, which should be
an error rather than falling through into DT_DEBUG! There was another #ifdef
bug where we'd only report unexpected DT_ entries on MIPS.
Change-Id: Id1d04e372611f641c1aa278a18e379f28af9eaf5
diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp
index d234787..166efac 100644
--- a/linker/dlfcn.cpp
+++ b/linker/dlfcn.cpp
@@ -143,12 +143,12 @@
return do_dlclose(reinterpret_cast<soinfo*>(handle));
}
-#if defined(ANDROID_ARM_LINKER)
+#if defined(__arm__)
// 0000000 00011111 111112 22222222 2333333 3333444444444455555555556666666 6667777777777888 8888888
// 0123456 78901234 567890 12345678 9012345 6789012345678901234567890123456 7890123456789012 3456789
#define ANDROID_LIBDL_STRTAB \
"dlopen\0dlclose\0dlsym\0dlerror\0dladdr\0android_update_LD_LIBRARY_PATH\0dl_iterate_phdr\0dl_unwind_find_exidx\0"
-#elif defined(ANDROID_MIPS_LINKER) || defined(ANDROID_X86_LINKER) || defined(ANDROID_X86_64_LINKER)
+#elif defined(__i386__) || defined(__mips__) || defined(__x86_64__)
// 0000000 00011111 111112 22222222 2333333 3333444444444455555555556666666 6667
// 0123456 78901234 567890 12345678 9012345 6789012345678901234567890123456 7890
#define ANDROID_LIBDL_STRTAB \
@@ -195,7 +195,7 @@
ELF_SYM_INITIALIZER(29, &dladdr, 1),
ELF_SYM_INITIALIZER(36, &android_update_LD_LIBRARY_PATH, 1),
ELF_SYM_INITIALIZER(67, &dl_iterate_phdr, 1),
-#if defined(ANDROID_ARM_LINKER)
+#if defined(__arm__)
ELF_SYM_INITIALIZER(83, &dl_unwind_find_exidx, 1),
#endif
};
@@ -219,7 +219,7 @@
// Note that adding any new symbols here requires
// stubbing them out in libdl.
static unsigned gLibDlBuckets[1] = { 1 };
-#if defined(ANDROID_ARM_LINKER)
+#if defined(__arm__)
static unsigned gLibDlChains[9] = { 0, 2, 3, 4, 5, 6, 7, 8, 0 };
#else
static unsigned gLibDlChains[8] = { 0, 2, 3, 4, 5, 6, 7, 0 };
@@ -257,7 +257,7 @@
.bucket = gLibDlBuckets,
.chain = gLibDlChains,
-#if defined(ANDROID_X86_64_LINKER)
+#if defined(USE_RELA)
.plt_rela = 0,
.plt_rela_count = 0,
.rela = 0,
@@ -282,10 +282,10 @@
.init_func = 0,
.fini_func = 0,
-#if defined(ANDROID_ARM_LINKER)
+#if defined(__arm__)
.ARM_exidx = 0,
.ARM_exidx_count = 0,
-#elif defined(ANDROID_MIPS_LINKER)
+#elif defined(__mips__)
.mips_symtabno = 0,
.mips_local_gotno = 0,
.mips_gotsym = 0,