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