aboutsummaryrefslogtreecommitdiff
path: root/binutils/objdump.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2009-01-27 15:41:56 +0000
committerNick Clifton <nickc@redhat.com>2009-01-27 15:41:56 +0000
commit1b0adfe09ccf94ad63361691d2e9e81b22896267 (patch)
treea73c7e014c93e2c0f36ed5b6cca47c270c4066e2 /binutils/objdump.c
parent9f04c329a35831433f6fb0f03a387f56d2797dcf (diff)
downloadfsf-binutils-gdb-1b0adfe09ccf94ad63361691d2e9e81b22896267.zip
fsf-binutils-gdb-1b0adfe09ccf94ad63361691d2e9e81b22896267.tar.gz
fsf-binutils-gdb-1b0adfe09ccf94ad63361691d2e9e81b22896267.tar.bz2
PR 9774
* objdump.c (disassemble_section): When the target uses signed addresses make sure that we compute signed values.
Diffstat (limited to 'binutils/objdump.c')
-rw-r--r--binutils/objdump.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c
index ed5bccf..87ccc64 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -1,6 +1,6 @@
/* objdump.c -- dump information about an object file.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -1708,6 +1708,8 @@ disassemble_bytes (struct disassemble_info * info,
static void
disassemble_section (bfd *abfd, asection *section, void *info)
{
+ const struct elf_backend_data * bed;
+ bfd_vma sign_adjust = 0;
struct disassemble_info * pinfo = (struct disassemble_info *) info;
struct objdump_disasm_info * paux;
unsigned int opb = pinfo->octets_per_byte;
@@ -1775,7 +1777,6 @@ disassemble_section (bfd *abfd, asection *section, void *info)
qsort (rel_pp, rel_count, sizeof (arelent *), compare_relocs);
}
}
-
}
rel_ppend = rel_pp + rel_count;
@@ -1821,6 +1822,14 @@ disassemble_section (bfd *abfd, asection *section, void *info)
sym = find_symbol_for_address (section->vma + addr_offset, info, &place);
paux->require_sec = FALSE;
+ /* PR 9774: If the target used signed 32-bit addresses then we must make
+ sure that we sign extend the value that we calculate for 'addr' in the
+ loop below. */
+ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
+ && (bed = get_elf_backend_data (abfd)) != NULL
+ && bed->sign_extend_vma)
+ sign_adjust = 0x80000000;
+
/* Disassemble a block of instructions up to the address associated with
the symbol we have just found. Then print the symbol and find the
next symbol on. Repeat until we have disassembled the entire section
@@ -1833,6 +1842,7 @@ disassemble_section (bfd *abfd, asection *section, void *info)
bfd_boolean insns;
addr = section->vma + addr_offset;
+ addr = (addr ^ sign_adjust) - sign_adjust;
if (sym != NULL && bfd_asymbol_value (sym) <= addr)
{