6766a3d
--- binutils.orig/binutils/objdump.c	2018-03-05 17:04:19.901619738 +0000
6766a3d
+++ binutils-2.29/binutils/objdump.c	2018-03-05 17:10:08.334643096 +0000
6766a3d
@@ -664,9 +664,7 @@ slurp_dynamic_symtab (bfd *abfd)
6766a3d
 static bfd_boolean
6766a3d
 is_significant_symbol_name (const char * name)
6766a3d
 {
6766a3d
-  return strcmp (name, ".plt") == 0
6766a3d
-    ||   strcmp (name, ".got") == 0
6766a3d
-    ||   strcmp (name, ".plt.got") == 0;
6766a3d
+  return strncmp (name, ".plt", 4) == 0 || strcmp (name, ".got") == 0;
6766a3d
 }
6766a3d
 
6766a3d
 /* Filter out (in place) symbols that are useless for disassembly.
6766a3d
@@ -937,6 +935,7 @@ find_symbol_for_address (bfd_vma vma,
6766a3d
   asection *sec;
6766a3d
   unsigned int opb;
6766a3d
   bfd_boolean want_section;
6766a3d
+  long rel_count;
6766a3d
 
6766a3d
   if (sorted_symcount < 1)
6766a3d
     return NULL;
6766a3d
@@ -1065,33 +1064,59 @@ find_symbol_for_address (bfd_vma vma,
6766a3d
      and we have dynamic relocations available, then we can produce
6766a3d
      a better result by matching a relocation to the address and
6766a3d
      using the symbol associated with that relocation.  */
6766a3d
+  rel_count = aux->dynrelcount;
6766a3d
   if (!want_section
6766a3d
-      && aux->dynrelbuf != NULL
6766a3d
       && sorted_syms[thisplace]->value != vma
6766a3d
+      && rel_count > 0
6766a3d
+      && aux->dynrelbuf != NULL
6766a3d
+      && aux->dynrelbuf[0]->address <= vma
6766a3d
+      && aux->dynrelbuf[rel_count - 1]->address >= vma
6766a3d
       /* If we have matched a synthetic symbol, then stick with that.  */
6766a3d
       && (sorted_syms[thisplace]->flags & BSF_SYNTHETIC) == 0)
6766a3d
     {
6766a3d
-      long        rel_count;
6766a3d
-      arelent **  rel_pp;
6766a3d
+      arelent **  rel_low;
6766a3d
+      arelent **  rel_high;
6766a3d
 
6766a3d
-      for (rel_count = aux->dynrelcount, rel_pp = aux->dynrelbuf;
6766a3d
-	   rel_count--;)
6766a3d
+      rel_low = aux->dynrelbuf;
6766a3d
+      rel_high = rel_low + rel_count - 1;
6766a3d
+      while (rel_low <= rel_high)
6766a3d
 	{
6766a3d
-	  arelent * rel = rel_pp[rel_count];
6766a3d
+	  arelent ** rel_mid = &rel_low[(rel_high - rel_low) / 2];
6766a3d
+	  arelent *  rel = *rel_mid;
6766a3d
 
6766a3d
-	  if (rel->address == vma
6766a3d
-	      && rel->sym_ptr_ptr != NULL
6766a3d
-	      /* Absolute relocations do not provide a more helpful symbolic address.  */
6766a3d
-	      && ! bfd_is_abs_section ((* rel->sym_ptr_ptr)->section))
6766a3d
+	  if (rel->address == vma)
6766a3d
 	    {
6766a3d
-	      if (place != NULL)
6766a3d
-		* place = thisplace;
6766a3d
-	      return * rel->sym_ptr_ptr;
6766a3d
+	      /* Absolute relocations do not provide a more helpful
6766a3d
+	         symbolic address.  Find a non-absolute relocation
6766a3d
+	         with the same address.  */
6766a3d
+
6766a3d
+	      arelent **rel_vma = rel_mid;
6766a3d
+
6766a3d
+	      for (rel_mid--;
6766a3d
+		   rel_mid >= rel_low && rel_mid[0]->address == vma;
6766a3d
+		   rel_mid--)
6766a3d
+		rel_vma = rel_mid;
6766a3d
+
6766a3d
+	      for (; rel_vma <= rel_high && rel_vma[0]->address == vma;
6766a3d
+		   rel_vma++)
6766a3d
+		{
6766a3d
+		  rel = *rel_vma;
6766a3d
+		  if (rel->sym_ptr_ptr != NULL
6766a3d
+		      && ! bfd_is_abs_section ((* rel->sym_ptr_ptr)->section))
6766a3d
+		    {
6766a3d
+		      if (place != NULL)
6766a3d
+			* place = thisplace;
6766a3d
+		      return * rel->sym_ptr_ptr;
6766a3d
+		    }
6766a3d
+		}
6766a3d
+	      break;
6766a3d
 	    }
6766a3d
 
6766a3d
-	  /* We are scanning backwards, so if we go below the target address
6766a3d
-	     we have failed.  */
6766a3d
-	  if (rel_pp[rel_count]->address < vma)
6766a3d
+	  if (vma < rel->address)
6766a3d
+	    rel_high = rel_mid;
6766a3d
+	  else if (vma >= rel_mid[1]->address)
6766a3d
+	    rel_low = rel_mid + 1;
6766a3d
+	  else
6766a3d
 	    break;
6766a3d
 	}
6766a3d
     }