Bug 734812 - Make the linker error out when text relocations are defined with DF_TEXTREL. r=nfroyd
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 13 Mar 2012 09:48:20 +0100
changeset 88907 28920721ac6d41674158819e029bcbb8e4395f04
parent 88906 5168ba8c86f0ac4f6b4f15f981bc7ae770236bda
child 88908 35fb1400f0f7ab7fffaaf7836f6f38639aaa872d
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)
reviewersnfroyd
bugs734812
milestone13.0a1
Bug 734812 - Make the linker error out when text relocations are defined with DF_TEXTREL. r=nfroyd
mozglue/linker/CustomElf.cpp
mozglue/linker/CustomElf.h
--- a/mozglue/linker/CustomElf.cpp
+++ b/mozglue/linker/CustomElf.cpp
@@ -545,16 +545,21 @@ CustomElf::InitDyn(const Phdr *pt_dyn)
         if (dyn->d_un.d_val != RELOC()) {
           log("%s: Error: DT_PLTREL is not " STR_RELOC(), GetPath());
           return false;
         }
         break;
       case DT_FLAGS:
         {
            Word flags = dyn->d_un.d_val;
+           /* Treat as a DT_TEXTREL tag */
+           if (flags & DF_TEXTREL) {
+             log("%s: Text relocations are not supported", GetPath());
+             return false;
+           }
            /* we can treat this like having a DT_SYMBOLIC tag */
            flags &= ~DF_SYMBOLIC;
            if (flags)
              log("%s: Warning: unhandled flags #%" PRIxAddr" not handled",
                  GetPath(), flags);
         }
         break;
       case DT_SONAME: /* Should match GetName(), but doesn't matter */
--- a/mozglue/linker/CustomElf.h
+++ b/mozglue/linker/CustomElf.h
@@ -154,16 +154,19 @@
 #define DT_VERNEEDNUM 0x6fffffff
 #endif
 #ifndef DT_FLAGS
 #define DT_FLAGS 30
 #endif
 #ifndef DF_SYMBOLIC
 #define DF_SYMBOLIC 0x00000002
 #endif
+#ifndef DF_TEXTREL
+#define DF_TEXTREL 0x00000004
+#endif
 
 namespace Elf {
 
 /**
  * Define a few basic Elf Types
  */
 typedef Elf_(Phdr) Phdr;
 typedef Elf_(Dyn) Dyn;