Bug 729883 - Avoid linker warnings when starting up on Android. r=tglek
--- a/mozglue/linker/CustomElf.cpp
+++ b/mozglue/linker/CustomElf.cpp
@@ -536,16 +536,38 @@ CustomElf::InitDyn(const Phdr *pt_dyn)
case DT_FINI_ARRAY:
debug_dyn("DT_FINI_ARRAY", dyn);
fini_array.Init(GetPtr(dyn->d_un.d_ptr));
break;
case DT_FINI_ARRAYSZ:
debug_dyn("DT_FINI_ARRAYSZ", dyn);
fini_array.InitSize(dyn->d_un.d_val);
break;
+ case DT_PLTREL:
+ if (dyn->d_un.d_val != RELOC()) {
+ log("%s: Error: DT_PLTREL is not " STR_RELOC(), GetPath());
+ return false;
+ }
+ break;
+ case DT_SONAME: /* Should match GetName(), but doesn't matter */
+ case DT_SYMBOLIC: /* Indicates internal symbols should be looked up in
+ * the library itself first instead of the executable,
+ * which is actually what this linker does by default */
+ case RELOC(COUNT): /* Indicates how many relocations are relative, which
+ * is usually used to skip relocations on prelinked
+ * libraries. They are not supported anyways. */
+ case UNSUPPORTED_RELOC(COUNT): /* This should error out, but it doesn't
+ * really matter. */
+ case DT_VERSYM: /* DT_VER* entries are used for symbol versioning, which */
+ case DT_VERDEF: /* this linker doesn't support yet. */
+ case DT_VERDEFNUM:
+ case DT_VERNEED:
+ case DT_VERNEEDNUM:
+ /* Ignored */
+ break;
default:
log("%s: Warning: dynamic header type #%" PRIxAddr" not handled",
GetPath(), dyn->d_tag);
}
}
if (!buckets || !symnum) {
log("%s: Missing or broken DT_HASH", GetPath());
--- a/mozglue/linker/CustomElf.h
+++ b/mozglue/linker/CustomElf.h
@@ -109,32 +109,49 @@
#endif
/**
* Android system headers don't have all definitions
*/
#ifndef STN_UNDEF
#define STN_UNDEF 0
#endif
-
#ifndef DT_INIT_ARRAY
#define DT_INIT_ARRAY 25
#endif
-
#ifndef DT_FINI_ARRAY
#define DT_FINI_ARRAY 26
#endif
-
#ifndef DT_INIT_ARRAYSZ
#define DT_INIT_ARRAYSZ 27
#endif
-
#ifndef DT_FINI_ARRAYSZ
#define DT_FINI_ARRAYSZ 28
#endif
+#ifndef DT_RELACOUNT
+#define DT_RELACOUNT 0x6ffffff9
+#endif
+#ifndef DT_RELCOUNT
+#define DT_RELCOUNT 0x6ffffffa
+#endif
+#ifndef DT_VERSYM
+#define DT_VERSYM 0x6ffffff0
+#endif
+#ifndef DT_VERDEF
+#define DT_VERDEF 0x6ffffffc
+#endif
+#ifndef DT_VERDEFNUM
+#define DT_VERDEFNUM 0x6ffffffd
+#endif
+#ifndef DT_VERNEED
+#define DT_VERNEED 0x6ffffffe
+#endif
+#ifndef DT_VERNEEDNUM
+#define DT_VERNEEDNUM 0x6fffffff
+#endif
namespace Elf {
/**
* Define a few basic Elf Types
*/
typedef Elf_(Phdr) Phdr;
typedef Elf_(Dyn) Dyn;