aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2013-08-12 07:55:55 +0000
committerAndreas Schwab <schwab@linux-m68k.org>2013-08-12 07:55:55 +0000
commit643902a49a1a4d461d99d55f8e37a9d705177d1b (patch)
tree183a1da3d0751977b2c7dc939cd402f53b8b187a /binutils
parent959b6a66c570308a7b7a30ad0751c03a0beb7575 (diff)
downloadgdb-643902a49a1a4d461d99d55f8e37a9d705177d1b.zip
gdb-643902a49a1a4d461d99d55f8e37a9d705177d1b.tar.gz
gdb-643902a49a1a4d461d99d55f8e37a9d705177d1b.tar.bz2
PR binutils/15818
* objdump.c (disassemble_section): Return early if nothing from this section needs to be disassembled.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/objdump.c44
2 files changed, 29 insertions, 21 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index bd8acb3..ffb0300 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2013-08-12 Andreas Schwab <schwab@suse.de>
+
+ PR binutils/15818
+ * objdump.c (disassemble_section): Return early if nothing from
+ this section needs to be disassembled.
+
2013-08-09 Nick Clifton <nickc@redhat.com>
* readelf.c (get_machine_flags): Handle RL78 G10 flag.
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 394a647..89efc15 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -1,7 +1,7 @@
/* 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, 2009, 2010, 2011,
- 2012 Free Software Foundation, Inc.
+ 2012, 2013 Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -1915,6 +1915,27 @@ disassemble_section (bfd *abfd, asection *section, void *inf)
if (datasize == 0)
return;
+ if (start_address == (bfd_vma) -1
+ || start_address < section->vma)
+ addr_offset = 0;
+ else
+ addr_offset = start_address - section->vma;
+
+ if (stop_address == (bfd_vma) -1)
+ stop_offset = datasize / opb;
+ else
+ {
+ if (stop_address < section->vma)
+ stop_offset = 0;
+ else
+ stop_offset = stop_address - section->vma;
+ if (stop_offset > datasize / opb)
+ stop_offset = datasize / opb;
+ }
+
+ if (addr_offset >= stop_offset)
+ return;
+
/* Decide which set of relocs to use. Load them if necessary. */
paux = (struct objdump_disasm_info *) pinfo->application_data;
if (paux->dynrelbuf)
@@ -1965,32 +1986,13 @@ disassemble_section (bfd *abfd, asection *section, void *inf)
pinfo->buffer_length = datasize;
pinfo->section = section;
- if (start_address == (bfd_vma) -1
- || start_address < pinfo->buffer_vma)
- addr_offset = 0;
- else
- addr_offset = start_address - pinfo->buffer_vma;
-
- if (stop_address == (bfd_vma) -1)
- stop_offset = datasize / opb;
- else
- {
- if (stop_address < pinfo->buffer_vma)
- stop_offset = 0;
- else
- stop_offset = stop_address - pinfo->buffer_vma;
- if (stop_offset > pinfo->buffer_length / opb)
- stop_offset = pinfo->buffer_length / opb;
- }
-
/* Skip over the relocs belonging to addresses below the
start address. */
while (rel_pp < rel_ppend
&& (*rel_pp)->address < rel_offset + addr_offset)
++rel_pp;
- if (addr_offset < stop_offset)
- printf (_("\nDisassembly of section %s:\n"), section->name);
+ printf (_("\nDisassembly of section %s:\n"), section->name);
/* Find the nearest symbol forwards from our current position. */
paux->require_sec = TRUE;