Bug 729883 - Avoid linker warnings when starting up on Android. r=tglek
authorMike Hommey <mh+mozilla@glandium.org>
Mon, 27 Feb 2012 08:19:20 +0100
changeset 87783 962c92bbed02cfe7dc0169bfa264931e7713422d
parent 87782 a01cf079ee0bca3f876c00d5bb8e5fdfa2b22cb3
child 87784 14f43a9a1ecf78adc7f3abb05fc9f5e36ec32b81
push id783
push userlsblakk@mozilla.com
push dateTue, 24 Apr 2012 17:33:42 +0000
treeherdermozilla-esr52@b6627f28b7ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstglek
bugs729883
milestone13.0a1
Bug 729883 - Avoid linker warnings when starting up on Android. r=tglek
mozglue/linker/CustomElf.cpp
mozglue/linker/CustomElf.h
--- 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;