This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] ARM Disassembler fix


The attached patch fixes a bug that causes the disassembler to dump code when it should dump data.

I tested this by running the gas, binutils, ld, gcc, and g++ test suites. I also added a test case.

Please let me know if OK to commit.

Thanks,
	Daniel.

ChangeLog:

2009-12-28 Daniel Gutson <dgutson@codesourcery.com>

        opcodes/
        * arm-dis.c (print_insn): Fixed search for next
        symbol and data dumping condition, and the
        initial mapping symbol state.

        gas/testsuite/
        * gas/arm/dis-data.d: New test case.
        * gas/arm/dis-data.s: New file.
--
Daniel Gutson
CodeSourcery
www.codesourcery.com
? 6338_upstream.patch
? alignment_spec.patch
? disasm.patch
Index: gas/testsuite/gas/arm/dis-data.d
===================================================================
RCS file: gas/testsuite/gas/arm/dis-data.d
diff -N gas/testsuite/gas/arm/dis-data.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/arm/dis-data.d	28 Dec 2009 23:33:41 -0000
@@ -0,0 +1,9 @@
+# name: Data disassembler test 
+# objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arm.*
+
+Disassembly of section \.text:
+0x00000000 20010000 	.word	0x20010000
+0x00000004 000000f9 	.word	0x000000f9
+0x00000008 00004cd5 	.word	0x00004cd5
Index: gas/testsuite/gas/arm/dis-data.s
===================================================================
RCS file: gas/testsuite/gas/arm/dis-data.s
diff -N gas/testsuite/gas/arm/dis-data.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/arm/dis-data.s	28 Dec 2009 23:33:41 -0000
@@ -0,0 +1,5 @@
+.syntax unified
+.word	0x20010000
+.word	0x000000f9
+.word	0x00004cd5
+
Index: opcodes/arm-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/arm-dis.c,v
retrieving revision 1.119
diff -u -p -r1.119 arm-dis.c
--- opcodes/arm-dis.c	17 Dec 2009 09:52:15 -0000	1.119
+++ opcodes/arm-dis.c	28 Dec 2009 23:33:46 -0000
@@ -4355,7 +4355,7 @@ print_insn (bfd_vma pc, struct disassemb
   long		given;
   int           status;
   int           is_thumb = FALSE;
-  int           is_data = FALSE;
+  int           is_data = TRUE;
   int           little_code;
   unsigned int	size = 4;
   void	 	(*printer) (bfd_vma, struct disassemble_info *, long);
@@ -4415,7 +4415,7 @@ print_insn (bfd_vma pc, struct disassemb
       bfd_vma addr;
       int n;
       int last_sym = -1;
-      enum map_type type = MAP_ARM;
+      enum map_type type = MAP_DATA;
 
       if (pc <= last_mapping_addr)
 	last_mapping_sym = -1;
@@ -4478,7 +4478,9 @@ print_insn (bfd_vma pc, struct disassemb
 	  for (n = last_sym + 1; n < info->symtab_size; n++)
 	    {
 	      addr = bfd_asymbol_value (info->symtab[n]);
-	      if (addr > pc)
+	      if (addr > pc
+		  && (info->section == NULL
+		      || info->section == info->symtab[n]->section))
 		{
 		  if (addr - pc < size)
 		    size = addr - pc;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]