This is the mail archive of the binutils@sources.redhat.com 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]: Fix savannah/3331: Invalid group relaxation, bset uses aninvalid address (HC11)


Hi!

I've committed this patch to fix an invalid relaxation that is activated on HC11,
this bug is registered in Savannah:

Bug #3331:  Invalid group relaxation, bset uses an invalid address
   http://savannah.gnu.org/bugs/?func=detailbug&bug_id=3331&group_id=2424

I also added a testcase in the LD testsuite to show/check the fix.

Stephane

2003-04-26 Stephane Carrez <stcarrez at nerim dot fr>

	PR savannah/3331:
	* elf32-m68hc11.c (m68hc11_elf_relax_section): Clear prev_insn_group
	when we couldn't relax something.

2003-04-26 Stephane Carrez <stcarrez at nerim dot fr>

	* ld-m68hc11/bug-3331.d: New test.
	* ld-m68hc11/bug-3331.s: New file.

Index: bfd/elf32-m68hc11.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68hc11.c,v
retrieving revision 1.17
diff -u -p -r1.17 elf32-m68hc11.c
--- bfd/elf32-m68hc11.c	21 Apr 2003 13:22:14 -0000	1.17
+++ bfd/elf32-m68hc11.c	26 Apr 2003 11:52:28 -0000
@@ -1073,6 +1073,7 @@ m68hc11_elf_relax_section (abfd, sec, li
             }
         }
       prev_insn_branch = 0;
+      prev_insn_group = 0;
     }
 
   if (free_relocs != NULL)
Index: ld/testsuite/ld-m68hc11/bug-3331.d
===================================================================
RCS file: ld/testsuite/ld-m68hc11/bug-3331.d
diff -N ld/testsuite/ld-m68hc11/bug-3331.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-m68hc11/bug-3331.d	26 Apr 2003 11:52:28 -0000
@@ -0,0 +1,14 @@
+#source: bug-3331.s
+#as: -m68hc11
+#ld: --relax
+#objdump: -d --prefix-addresses -r
+#target: m6811-*-* m6812-*-*
+
+.*: +file format elf32-m68hc11
+
+Disassembly of section .text:
+0+8000 <_start> ldx	#0+1100 <__data_section_start>
+0+8003 <_start\+0x3> bset	0,x \#\$04
+0+8006 <L1> ldd	\#0+2 <__bss_size\+0x2>
+0+8009 <L1\+0x3> std	\*0+ <__bss_size>
+0+800b <L1\+0x5> rts
Index: ld/testsuite/ld-m68hc11/bug-3331.s
===================================================================
RCS file: ld/testsuite/ld-m68hc11/bug-3331.s
diff -N ld/testsuite/ld-m68hc11/bug-3331.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-m68hc11/bug-3331.s	26 Apr 2003 11:52:28 -0000
@@ -0,0 +1,23 @@
+;;; Bug #3331:	Invalid group relaxation, bset uses an invalid address
+;;; http://savannah.gnu.org/bugs/?func=detailbug&bug_id=3331&group_id=2424
+;;; 
+	.sect .text
+	.globl _start
+_start:
+	.relax	L1
+	ldx	#foo		;; This relax group must not be changed.
+	bset	0,x #4
+L1:
+	ldd	#2
+	std	table		;; This instruction uses a symbol in page0
+				;; and it triggered the relaxation of the
+				;; previous relax group
+	rts
+
+	.sect .page0
+	.globl table
+table:	.long 0
+
+	.sect .data
+	.globl foo
+foo:	.long 0

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