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]

Re: Patch h8300-elf


Paul <paulc@senet.com.au> writes:
> There is a bug in h8300-elf when relaxing, a word access to an 8 bit area
> would get an invalid 8 bit relocation.  The minimum addressing mode for
> a word access is 16 bits. This patch fixes the problem.

This looks good to me but (having turned down the maintainership,
at least for now) I'm not in a position to approve it.

One thing though: you didn't include a ChangeLog entry.  I'd suggest
something like:

	* elf32-h8300.c (R_H8_DIR32A16): Fix name field.
	(elf32_h8_relax_section) <R_H8_DIR16A8>: Adjust position of relocation.
	<R_H8_DIR32A16>: Fix type of relocation.

FWIW, I've attached a dejagnu testcase that fails before your patch and
passes afterwards.  The patch also fixes a couple of things in the
relax.d test.

Tested on h8300-elf and h8300-coff.

BTW, I notice that the range checks are wrong for h8s & h8sx.
I'll try to fix that soon.

Richard


	* ld-h8300/h8300.exp: Replace loop with explicit list.  Run relax.d
	unconditionally.  Run relax-2.d for *-elf targets.
	* ld-h8300/relax.d: Fix typo.
	* ld-h8300/relax.s: Add 0x prefixes.
	* ld-h8300/relad-2.[sd]: New test.

Index: ld/testsuite/ld-h8300/h8300.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-h8300/h8300.exp,v
retrieving revision 1.1
diff -c -d -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.1 h8300.exp
*** ld/testsuite/ld-h8300/h8300.exp	15 Nov 2002 11:18:49 -0000	1.1
--- ld/testsuite/ld-h8300/h8300.exp	3 Jul 2003 10:45:11 -0000
*************** if ![istarget h8300-*-*] {
*** 24,32 ****
      return
  }
  
! set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
! foreach test $test_list {
!     # We need to strip the ".d", but can leave the dirname.
!     verbose [file rootname $test]
!     run_dump_test [file rootname $test]
  }
--- 24,31 ----
      return
  }
  
! run_dump_test relax
! 
! if {[istarget *-elf]} {
!     run_dump_test relax-2
  }
Index: ld/testsuite/ld-h8300/relax.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-h8300/relax.d,v
retrieving revision 1.1
diff -c -d -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.1 relax.d
*** ld/testsuite/ld-h8300/relax.d	15 Nov 2002 11:18:49 -0000	1.1
--- ld/testsuite/ld-h8300/relax.d	3 Jul 2003 10:45:11 -0000
***************
*** 1,4 ****
! # name: H8300 Relxation Test
  # ld: --relax
  # objdump: -d --no-show-raw-insn
  
--- 1,4 ----
! # name: H8300 Relaxation Test
  # ld: --relax
  # objdump: -d --no-show-raw-insn
  
*************** Disassembly of section .text:
*** 11,18 ****
  
  00000100 <_start>:
   100:	0d 00             mov.w	r0,r0
!  102:	47 02             beq	.+2 \(106\)
!  104:	55 02             bsr	.+2 \(108\)
  
  00000106 <.L1>:
   106:	54 70             rts	
--- 11,18 ----
  
  00000100 <_start>:
   100:	0d 00             mov.w	r0,r0
!  102:	47 02             beq	.+2 \(0x106\)
!  104:	55 02             bsr	.+2 \(0x108\)
  
  00000106 <.L1>:
   106:	54 70             rts	
*** /dev/null	Tue Jun 17 23:06:41 2003
--- ld/testsuite/ld-h8300/relax-2.d	Thu Jul  3 11:53:27 2003
***************
*** 0 ****
--- 1,11 ----
+ # name: H8300 Relaxation Test 2
+ # ld: --relax -m h8300helf
+ # objdump: -d --no-show-raw-insn
+ 
+ .*:     file format .*-h8300
+ 
+ Disassembly of section .text:
+ 
+ 00000100 <_start>:
+  *100:	28 67       * mov.b	@0x67:8,r0l
+  *102:	6a 08 43 21 * mov.b	@0x4321:16,r0l
*** /dev/null	Tue Jun 17 23:06:41 2003
--- ld/testsuite/ld-h8300/relax-2.s	Thu Jul  3 11:49:10 2003
***************
*** 0 ****
--- 1,8 ----
+ 	.h8300h
+ 	.globl	_start
+ _start:
+ 	mov.b	@foo:16,r0l
+ 	mov.b	@bar:32,r0l
+ 
+ 	.equ	foo,0xffff67
+ 	.equ	bar,0x4321


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