[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#847527: FTBFS on mips*



Hi,

Thanks for doing an upload addressing this bug. Unfortunately the wrong
fix got applied, so the problem is still there. Bug#844227 is about
PR20828 upstream, while the 2.27.90.20170113-1 upload addresses PR20649
instead, like said in the changelog. PR20649 was already addressed, so
the pr20649.diff patch has just been refreshed in the upload.

Please find attached a debdiff to fully fix the bug PR20828. It only
touches MIPS code, so there is no risk for the other architectures.

Thanks,
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net
diff -u binutils-2.27.90.20170113/debian/changelog binutils-2.27.90.20170113/debian/changelog
--- binutils-2.27.90.20170113/debian/changelog
+++ binutils-2.27.90.20170113/debian/changelog
@@ -1,3 +1,10 @@
+binutils (2.27.90.20170113-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Apply proposed patch for PR ld/20828 (mips). Closes: #844227.
+
+ -- Aurelien Jarno <aurel32@debian.org>  Fri, 13 Jan 2017 20:23:50 +0100
+
 binutils (2.27.90.20170113-1) unstable; urgency=medium
 
   * New upstream snapshot, taken from the binutils 2.28 branch.
diff -u binutils-2.27.90.20170113/debian/patches/series binutils-2.27.90.20170113/debian/patches/series
--- binutils-2.27.90.20170113/debian/patches/series
+++ binutils-2.27.90.20170113/debian/patches/series
@@ -28,4 +28,5 @@
 ld-new-dtags-by-default.diff
 pr20649.diff
+pr20828.diff
 
 # patches taken from the trunk
only in patch2:
unchanged:
--- binutils-2.27.90.20170113.orig/debian/patches/pr20828.diff
+++ binutils-2.27.90.20170113/debian/patches/pr20828.diff
@@ -0,0 +1,83 @@
+# DP: Proposed patch for PR ld/20828 (mips).
+
+--- a/bfd/elfxx-mips.c
++++ b/bfd/elfxx-mips.c
+@@ -743,6 +743,8 @@ static struct mips_got_entry *mips_elf_create_local_got_entry
+    struct mips_elf_link_hash_entry *, int);
+ static bfd_boolean mips_elf_sort_hash_table_f
+   (struct mips_elf_link_hash_entry *, void *);
++static bfd_boolean mips_elf_sort_hash_table_local_f
++  (struct mips_elf_link_hash_entry *, void *);
+ static bfd_vma mips_elf_high
+   (bfd_vma);
+ static bfd_boolean mips_elf_create_dynamic_relocation
+@@ -3850,6 +3852,11 @@ mips_elf_sort_hash_table (bfd *abfd, struct bfd_link_info *info)
+     = hsd.min_got_dynindx
+     = (elf_hash_table (info)->dynsymcount - g->reloc_only_gotno);
+   hsd.max_non_got_dynindx = count_section_dynsyms (abfd, info) + 1;
++
++  mips_elf_link_hash_traverse (((struct mips_elf_link_hash_table *)
++                    elf_hash_table (info)),
++                    mips_elf_sort_hash_table_local_f,
++                    &hsd);
+   mips_elf_link_hash_traverse (((struct mips_elf_link_hash_table *)
+ 				elf_hash_table (info)),
+ 			       mips_elf_sort_hash_table_f,
+@@ -3879,28 +3886,40 @@ mips_elf_sort_hash_table_f (struct mips_elf_link_hash_entry *h, void *data)
+ {
+   struct mips_elf_hash_sort_data *hsd = data;
+ 
+-  /* Symbols without dynamic symbol table entries aren't interesting
+-     at all.  */
+-  if (h->root.dynindx == -1)
++  /* Only interested in global symbols with dynamic symbol table entries */
++  if (h->root.dynindx == -1 || h->root.forced_local)
+     return TRUE;
+ 
+-  switch (h->global_got_area)
+-    {
+-    case GGA_NONE:
++  if (h->global_got_area == GGA_NONE) {
+       h->root.dynindx = hsd->max_non_got_dynindx++;
+-      break;
++  } else {
++      if (h->global_got_area == GGA_NORMAL)
++          h->root.dynindx = --hsd->min_got_dynindx;
++      else
++          h->root.dynindx = hsd->max_unref_got_dynindx++;
+ 
+-    case GGA_NORMAL:
+-      h->root.dynindx = --hsd->min_got_dynindx;
+-      hsd->low = (struct elf_link_hash_entry *) h;
+-      break;
++      if (hsd->low == NULL || h->root.dynindx < hsd->low->dynindx)
++          hsd->low = (struct elf_link_hash_entry *) h;
++  }
+ 
+-    case GGA_RELOC_ONLY:
+-      if (hsd->max_unref_got_dynindx == hsd->min_got_dynindx)
+-	hsd->low = (struct elf_link_hash_entry *) h;
+-      h->root.dynindx = hsd->max_unref_got_dynindx++;
+-      break;
+-    }
++  return TRUE;
++}
++
++/* All local symbols must be appear before global symbols in the dynamic symbol
++   table so they're assigned indexs first. */
++
++static bfd_boolean
++mips_elf_sort_hash_table_local_f (struct mips_elf_link_hash_entry *h, void *data)
++{
++  struct mips_elf_hash_sort_data *hsd = data;
++
++  /* Only interested in local symbols with dynamic symbol table entries */
++  if (h->root.dynindx == -1 || !h->root.forced_local)
++    return TRUE;
++
++  h->root.dynindx = hsd->max_non_got_dynindx++;
++  if (h->global_got_area != GGA_NONE && hsd->low == NULL)
++      hsd->low = (struct elf_link_hash_entry *) h;
+ 
+   return TRUE;
+ }

Attachment: signature.asc
Description: PGP signature


Reply to: