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