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]

[ARM] objdump and disassembler_needs_relocs


Hi all,

While working on other bug fixes and analyzing objdump outputs, I noticed that some addresses were incorrectly displayed.

The is because on ARM 'disassembler_needs_relocs' is true, and relocations from previous instructions are used to print addresses of the next ones.

OK?

Christophe.

Attachment: objdump-needrelocs.changelog
Description: Text document

Index: binutils/objdump.c
===================================================================
RCS file: /cvs/src/src/binutils/objdump.c,v
retrieving revision 1.170
diff -u -b -p -r1.170 objdump.c
--- binutils/objdump.c	28 Jan 2010 15:25:20 -0000	1.170
+++ binutils/objdump.c	5 Feb 2010 16:20:39 -0000
@@ -1516,6 +1516,9 @@ disassemble_bytes (struct disassemble_in
       previous_octets = octets;
       octets = 0;
 
+      /* Make sure we don't use relocs from previous instructions.  */
+      aux->reloc = NULL;
+
       /* If we see more than SKIP_ZEROES octets of zeroes, we just
 	 print `...'.  */
       for (z = addr_offset * opb; z < stop_offset * opb; z++)
@@ -1619,8 +1622,6 @@ disassemble_bytes (struct disassemble_in
 		      inf->flags |= INSN_HAS_RELOC;
 		      aux->reloc = **relppp;
 		    }
-		  else
-		    aux->reloc = NULL;
 		}
 
 	      octets = (*disassemble_fn) (section->vma + addr_offset, inf);
Index: gas/testsuite/gas/arm/arm-it-auto.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arm/arm-it-auto.d,v
retrieving revision 1.2
diff -u -b -p -r1.2 arm-it-auto.d
--- gas/testsuite/gas/arm/arm-it-auto.d	29 Jun 2009 08:08:15 -0000	1.2
+++ gas/testsuite/gas/arm/arm-it-auto.d	5 Feb 2010 16:20:39 -0000
@@ -71,11 +71,11 @@ Disassembly of section .text:
 0000008c <main\+0x8c> bf18      	it	ne
 0000008e <main\+0x8e> 200d      	movne	r0, #13
 00000090 <main\+0x90> f... f... 	bl	0000000. <f.*>
-00000094 <f\+0x94> bd10      	pop	{r4, pc}
-00000096 <f\+0x96> f... f... 	bl	0000000. <f.*>
-0000009a <f\+0x9a> bfb8      	it	lt
-0000009c <f\+0x9c> 2000      	movlt	r0, #0
-0000009e <f\+0x9e> 4348      	muls	r0, r1
-000000a0 <f\+0xa0> bfb8      	it	lt
-000000a2 <f\+0xa2> 2000      	movlt	r0, #0
-000000a4 <f\+0xa4> 4348      	muls	r0, r1
+00000094 <main\+0x94> bd10      	pop	{r4, pc}
+00000096 <main\+0x96> f... f... 	bl	0000000. <f.*>
+0000009a <main\+0x9a> bfb8      	it	lt
+0000009c <main\+0x9c> 2000      	movlt	r0, #0
+0000009e <main\+0x9e> 4348      	muls	r0, r1
+000000a0 <main\+0xa0> bfb8      	it	lt
+000000a2 <main\+0xa2> 2000      	movlt	r0, #0
+000000a4 <main\+0xa4> 4348      	muls	r0, r1
Index: gas/testsuite/gas/arm/bl-local-v4t.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arm/bl-local-v4t.d,v
retrieving revision 1.2
diff -u -b -p -r1.2 bl-local-v4t.d
--- gas/testsuite/gas/arm/bl-local-v4t.d	30 Jun 2009 11:57:05 -0000	1.2
+++ gas/testsuite/gas/arm/bl-local-v4t.d	5 Feb 2010 16:20:39 -0000
@@ -7,13 +7,13 @@
 .*: +file format .*arm.*
 Disassembly of section .text:
 0+00 <[^>]*> f7ff fffe 	bl	00+18 <[^>]*>	0: R_ARM_THM_CALL	foo2
-0+1c <[^>]*> d004      	beq.n	00+28 <[^>]*>
-0+1e <[^>]*> e003      	b.n	00+28 <[^>]*>
-0+20 <[^>]*> f000 f808 	bl	00+34 <[^>]*>
-0+24 <[^>]*> f000 f802 	bl	00+2c <[^>]*>
-0+28 <[^>]*> 46c0      	nop			; \(mov r8, r8\)
-0+2a <[^>]*> 46c0      	nop			; \(mov r8, r8\)
-0+2c <[^>]*> 46c0      	nop			; \(mov r8, r8\)
+0+04 <[^>]*> d004      	beq.n	00+10 <[^>]*>
+0+06 <[^>]*> e003      	b.n	00+10 <[^>]*>
+0+08 <[^>]*> f000 f808 	bl	00+1c <[^>]*>
+0+0c <[^>]*> f000 f802 	bl	00+14 <[^>]*>
+0+10 <[^>]*> 46c0      	nop			; \(mov r8, r8\)
+0+12 <[^>]*> 46c0      	nop			; \(mov r8, r8\)
+0+14 <[^>]*> 46c0      	nop			; \(mov r8, r8\)
 	...
-0+30 <[^>]*> e1a00000 	nop			; \(mov r0, r0\)
-0+34 <[^>]*> e1a00000 	nop			; \(mov r0, r0\)
+0+18 <[^>]*> e1a00000 	nop			; \(mov r0, r0\)
+0+1c <[^>]*> e1a00000 	nop			; \(mov r0, r0\)
Index: gas/testsuite/gas/arm/blx-local.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arm/blx-local.d,v
retrieving revision 1.5
diff -u -b -p -r1.5 blx-local.d
--- gas/testsuite/gas/arm/blx-local.d	30 Jun 2009 11:57:05 -0000	1.5
+++ gas/testsuite/gas/arm/blx-local.d	5 Feb 2010 16:20:39 -0000
@@ -23,7 +23,7 @@ Disassembly of section .text:
 0+2c <[^>]*> 0afffffc 	beq	00000024 <fooundefthumb>
 0+30 <[^>]*> eafffffb 	b	00000024 <fooundefthumb>
 0+34 <[^>]*> 0bfffffe 	bleq	00000020 <foo>	34: R_ARM_JUMP24	foo
-0+58 <[^>]*> 0afffffe 	beq	00000020 <foo>	38: R_ARM_JUMP24	foo
-0+5c <[^>]*> eafffffe 	b	00000020 <foo>	3c: R_ARM_JUMP24	foo
-0+60 <[^>]*> e1a00000 	nop			; \(mov r0, r0\)
-0+64 <[^>]*> e1a00000 	nop			; \(mov r0, r0\)
+0+38 <[^>]*> 0afffffe 	beq	00000020 <foo>	38: R_ARM_JUMP24	foo
+0+3c <[^>]*> eafffffe 	b	00000020 <foo>	3c: R_ARM_JUMP24	foo
+0+40 <[^>]*> e1a00000 	nop			; \(mov r0, r0\)
+0+44 <[^>]*> e1a00000 	nop			; \(mov r0, r0\)
Index: gas/testsuite/gas/arm/thumb-w-good.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arm/thumb-w-good.d,v
retrieving revision 1.1
diff -u -b -p -r1.1 thumb-w-good.d
--- gas/testsuite/gas/arm/thumb-w-good.d	14 Jul 2009 12:54:47 -0000	1.1
+++ gas/testsuite/gas/arm/thumb-w-good.d	5 Feb 2010 16:20:39 -0000
@@ -6,4 +6,4 @@
 
 Disassembly of section .text:
 00000000 <.text> f7ff fffe 	bl	00000000 <foo>
-00000004 <foo\+0x4> f3ef 8000 	mrs	r0, CPSR
+00000004 <.text\+0x4> f3ef 8000 	mrs	r0, CPSR

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