]> code.ossystems Code Review - openembedded-core.git/commitdiff
binutils-cross: fix '-fPIE' on mips platform
authorKevin Tian <kevin.tian@intel.com>
Thu, 15 Jul 2010 09:22:09 +0000 (10:22 +0100)
committerRichard Purdie <rpurdie@linux.intel.com>
Thu, 15 Jul 2010 09:22:09 +0000 (10:22 +0100)
Current binutils generates problematic relocation table for executable
compiled with '-fPIE', such as dbus-daemon. That way ld.so.1 falls into
segmentation fault when accessing bad reloc entry. This pulls back one
fix from binutils CVS repo (1.267) to add PIE support back.

Signed-off-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
meta/packages/binutils/binutils-2.20.1/binutils-mips-pie.patch [new file with mode: 0644]
meta/packages/binutils/binutils_2.20.1.bb

diff --git a/meta/packages/binutils/binutils-2.20.1/binutils-mips-pie.patch b/meta/packages/binutils/binutils-2.20.1/binutils-mips-pie.patch
new file mode 100644 (file)
index 0000000..c71f0ad
--- /dev/null
@@ -0,0 +1,29 @@
+# "-fPIE" always triggers segmentation fault in ld.so.1 on mips platform,
+# which was first saw on dbus-daemon. Below borrow the binutils fix from
+# binutils bugzilla:
+#
+#      http://sourceware.org/bugzilla/show_bug.cgi?id=10858
+#
+# Its commit message says:
+#      * elfxx-mips.c (mips_elf_create_dynamic_relocation): Use section
+#      sym dynindx for relocs against defined syms in PIEs.
+#
+# It's in upstream CVS now (rev 1.267), but not in current release
+#
+# By Kevin Tian <kevin.tian@intel.com>, 2010-07-15
+
+diff --git a/elfxx-mips.c b/elfxx-mips.c
+index 3a1c8ba..f6c2c1c 100644
+--- binutils-2.20.1.orig/bfd/elfxx-mips.c
++++ binutils-2.20.1/bfd/elfxx-mips.c
+@@ -5688,9 +5688,7 @@ mips_elf_create_dynamic_relocation (bfd *output_bfd,
+   /* We must now calculate the dynamic symbol table index to use
+      in the relocation.  */
+-  if (h != NULL
+-      && (!h->root.def_regular
+-        || (info->shared && !info->symbolic && !h->root.forced_local)))
++  if (h != NULL && ! SYMBOL_REFERENCES_LOCAL (info, &h->root))
+     {
+       indx = h->root.dynindx;
+       if (SGI_COMPAT (output_bfd))
index 2c67844eb923225b8e8a72722560b7d218340f3a..3197b5efb30ef18f694e043f7aaefaa9add48389 100644 (file)
@@ -24,6 +24,7 @@ SRC_URI = "\
      file://binutils-uclibc-300-012_check_ldrunpath_length.patch \
      file://binutils-uclibc-gas-needs-libm.patch \
      file://binutils-x86_64_i386_biarch.patch \
+     file://binutils-mips-pie.patch \
      "
 
 # powerpc patches