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 88937 28920721ac6d41674158819e029bcbb8e4395f04
parent 88936 5168ba8c86f0ac4f6b4f15f981bc7ae770236bda
child 88938 35fb1400f0f7ab7fffaaf7836f6f38639aaa872d
push id22233
push usermak77@bonardo.net
push dateTue, 13 Mar 2012 13:50:06 +0000
treeherdermozilla-central@d87ad51531b5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnfroyd
bugs734812
milestone13.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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;