aboutsummaryrefslogtreecommitdiff
path: root/binutils/objdump.c
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2007-05-22 15:05:12 +0000
committerPaul Brook <paul@codesourcery.com>2007-05-22 15:05:12 +0000
commite39ff52a3b2235defefee5e37d4a048c066c6384 (patch)
tree5bec89fb12bd748da0c3b94c8343defaeb67f226 /binutils/objdump.c
parent23776285b76dc215c60997f27ed37f37dbc63165 (diff)
downloadgdb-e39ff52a3b2235defefee5e37d4a048c066c6384.zip
gdb-e39ff52a3b2235defefee5e37d4a048c066c6384.tar.gz
gdb-e39ff52a3b2235defefee5e37d4a048c066c6384.tar.bz2
2007-05-22 Paul Brook <paul@codesourcery.com>
bunutils/ * objdump.c (find_symbol_for_address): Merge section and target specific filtering code. ld/testsuite/ * ld-arm-mixed-lib.d: Update expected output. * ld-arm/arm-app.d: Ditto. * ld-arm/mixed-app.d: Ditto. * ld-arm/arm-lib-plt32.d: Ditto. * ld-arm/arm-app-abs32.d: Ditto. * ld-arm/mixed-app-v5.d: Ditto. * ld-arm/armthumb-lib.d: Ditto. * ld-arm/arm-lib.d: Ditto. gas/testsuite/ * gas/arm/backslash-at.d: Update expected output.
Diffstat (limited to 'binutils/objdump.c')
-rw-r--r--binutils/objdump.c63
1 files changed, 32 insertions, 31 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 82a6a39..a8cad9b 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -687,6 +687,7 @@ find_symbol_for_address (bfd_vma vma,
bfd *abfd;
asection *sec;
unsigned int opb;
+ bfd_boolean want_section;
if (sorted_symcount < 1)
return NULL;
@@ -732,15 +733,19 @@ find_symbol_for_address (bfd_vma vma,
Note that this may be wrong for some symbol references if the
sections have overlapping memory ranges, but in that case there's
no way to tell what's desired without looking at the relocation
- table. */
- if (sorted_syms[thisplace]->section != sec
- && (aux->require_sec
- || ((abfd->flags & HAS_RELOC) != 0
- && vma >= bfd_get_section_vma (abfd, sec)
- && vma < (bfd_get_section_vma (abfd, sec)
- + bfd_section_size (abfd, sec) / opb))))
+ table.
+
+ Also give the target a chance to reject symbols. */
+ want_section = (aux->require_sec
+ || ((abfd->flags & HAS_RELOC) != 0
+ && vma >= bfd_get_section_vma (abfd, sec)
+ && vma < (bfd_get_section_vma (abfd, sec)
+ + bfd_section_size (abfd, sec) / opb)));
+ if ((sorted_syms[thisplace]->section != sec && want_section)
+ || !info->symbol_is_valid (sorted_syms[thisplace], info))
{
long i;
+ long newplace;
for (i = thisplace + 1; i < sorted_symcount; i++)
{
@@ -750,27 +755,36 @@ find_symbol_for_address (bfd_vma vma,
}
--i;
+ newplace = sorted_symcount;
for (; i >= 0; i--)
{
- if (sorted_syms[i]->section == sec
- && (i == 0
- || sorted_syms[i - 1]->section != sec
- || (bfd_asymbol_value (sorted_syms[i])
- != bfd_asymbol_value (sorted_syms[i - 1]))))
+ if ((sorted_syms[i]->section == sec || !want_section)
+ && info->symbol_is_valid (sorted_syms[i], info))
{
- thisplace = i;
- break;
+ if (newplace == sorted_symcount)
+ newplace = i;
+
+ if (bfd_asymbol_value (sorted_syms[i])
+ != bfd_asymbol_value (sorted_syms[newplace]))
+ break;
+
+ /* Remember this symbol and keep searching until we reach
+ an earlier address. */
+ newplace = i;
}
}
- if (sorted_syms[thisplace]->section != sec)
+ if (newplace != sorted_symcount)
+ thisplace = newplace;
+ else
{
/* We didn't find a good symbol with a smaller value.
Look for one with a larger value. */
for (i = thisplace + 1; i < sorted_symcount; i++)
{
- if (sorted_syms[i]->section == sec)
+ if ((sorted_syms[i]->section == sec || !want_section)
+ && info->symbol_is_valid (sorted_syms[i], info))
{
thisplace = i;
break;
@@ -778,25 +792,12 @@ find_symbol_for_address (bfd_vma vma,
}
}
- if (sorted_syms[thisplace]->section != sec
- && (aux->require_sec
- || ((abfd->flags & HAS_RELOC) != 0
- && vma >= bfd_get_section_vma (abfd, sec)
- && vma < (bfd_get_section_vma (abfd, sec)
- + bfd_section_size (abfd, sec)))))
+ if ((sorted_syms[thisplace]->section != sec && want_section)
+ || !info->symbol_is_valid (sorted_syms[thisplace], info))
/* There is no suitable symbol. */
return NULL;
}
- /* Give the target a chance to reject the symbol. */
- while (! info->symbol_is_valid (sorted_syms [thisplace], info))
- {
- ++ thisplace;
- if (thisplace >= sorted_symcount
- || bfd_asymbol_value (sorted_syms [thisplace]) > vma)
- return NULL;
- }
-
if (place != NULL)
*place = thisplace;