This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Fix disassembly of arm object files with multiple sections
- From: Richard Earnshaw <Richard dot Earnshaw at buzzard dot freeserve dot co dot uk>
- To: binutils at sourceware dot org
- Date: Fri, 20 Apr 2007 01:02:52 +0100
- Subject: Fix disassembly of arm object files with multiple sections
A bug in the way we look for mapping symbols means that sometimes we
incorrectly disassemble object files. This is fixed by only looking for
mapping symbols in the section being disassembled.
R.
Index: gas/testsuite/gas/arm/mapshort-eabi.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arm/mapshort-eabi.d,v
retrieving revision 1.1
diff -p -r1.1 mapshort-eabi.d
*** gas/testsuite/gas/arm/mapshort-eabi.d 28 Feb 2007 14:39:15 -0000 1.1
--- gas/testsuite/gas/arm/mapshort-eabi.d 19 Apr 2007 23:54:15 -0000
*************** SYMBOL TABLE:
*** 21,26 ****
--- 21,28 ----
0+18 l .text 00000000 \$a
0+1c l .text 00000000 \$d
0+1f l .text 00000000 bar
+ 0+00 l .data 00000000 wibble
+ 0+00 l .data 00000000 \$d
0+00 l d .ARM.attributes 00000000 .ARM.attributes
Index: gas/testsuite/gas/arm/mapshort-elf.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arm/mapshort-elf.d,v
retrieving revision 1.1
diff -p -r1.1 mapshort-elf.d
*** gas/testsuite/gas/arm/mapshort-elf.d 28 Feb 2007 14:39:15 -0000 1.1
--- gas/testsuite/gas/arm/mapshort-elf.d 19 Apr 2007 23:54:15 -0000
*************** SYMBOL TABLE:
*** 21,26 ****
--- 21,28 ----
0+18 l .text 00000000 \$a
0+1c l .text 00000000 \$d
0+1f l .text 00000000 bar
+ 0+00 l .data 00000000 wibble
+ 0+00 l .data 00000000 \$d
# The ELF based port does not generate a .ARM.attributes symbol
Disassembly of section .text:
Index: gas/testsuite/gas/arm/mapshort.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arm/mapshort.s,v
retrieving revision 1.1
diff -p -r1.1 mapshort.s
*** gas/testsuite/gas/arm/mapshort.s 22 Nov 2006 17:45:56 -0000 1.1
--- gas/testsuite/gas/arm/mapshort.s 19 Apr 2007 23:54:15 -0000
*************** foo:
*** 19,21 ****
--- 19,24 ----
.byte 9
bar:
.byte 10
+ .data
+ wibble:
+ .word 0
Index: opcodes/arm-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/arm-dis.c,v
retrieving revision 1.80
diff -p -r1.80 arm-dis.c
*** opcodes/arm-dis.c 27 Mar 2007 21:09:53 -0000 1.80
--- opcodes/arm-dis.c 19 Apr 2007 23:54:17 -0000
***************
*** 1,6 ****
/* Instruction printing code for the ARM
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
2003, 2004
! Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
Modification by James G. Smith (jsmith@cygnus.co.uk)
--- 1,6 ----
/* Instruction printing code for the ARM
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
2003, 2004
! 2007, Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
Modification by James G. Smith (jsmith@cygnus.co.uk)
*************** print_insn (bfd_vma pc, struct disassemb
*** 3982,3988 ****
addr = bfd_asymbol_value (info->symtab[n]);
if (addr > pc)
break;
! if (get_sym_code_type (info, n, &type))
{
last_sym = n;
found = TRUE;
--- 3982,3990 ----
addr = bfd_asymbol_value (info->symtab[n]);
if (addr > pc)
break;
! if ((info->section == NULL
! || info->section == info->symtab[n]->section)
! && get_sym_code_type (info, n, &type))
{
last_sym = n;
found = TRUE;