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 off-by-one error in tc-mn10300.c relax table


Hi Guys,

  I am applying the patch below to fix a relaxation problem with the
  MN10300 port recently reported by one of our customers.  The
  md_relax_table has a couple of offsets that are off by one.  The
  patch fixes this and also adds a test to the gas testsuite to make
  sure that the problem remains fixed.

Cheers
    Nick

gas/ChangeLog
2004-11-12  Nick Clifton  <nickc@redhat.com>

	* config/tc-mn10300.c (md_relax_table): Fix off by one negative
	offsets for conditional branches.

gas/testsuite/ChangeLog
2004-11-12  Nick Clifton  <nickc@redhat.com>

	* gas/mn10300/basic.exp: Add relax test.
	* gas/mn10300/relax.s: New test.
	* gas/mn10300/relax.d: Expected results.  Make sure that the
	correct size of instruction has been selected.

        
Index: gas/config/tc-mn10300.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mn10300.c,v
retrieving revision 1.47
diff -c -3 -p -r1.47 tc-mn10300.c
*** gas/config/tc-mn10300.c	28 May 2004 21:33:07 -0000	1.47
--- gas/config/tc-mn10300.c	12 Nov 2004 12:22:13 -0000
*************** const char FLT_CHARS[] = "dD";
*** 57,68 ****
  const relax_typeS md_relax_table[] = {
    /* bCC relaxing  */
    {0x7f, -0x80, 2, 1},
!   {0x7fff, -0x8000, 5, 2},
    {0x7fffffff, -0x80000000, 7, 0},
  
    /* bCC relaxing (uncommon cases)  */
    {0x7f, -0x80, 3, 4},
!   {0x7fff, -0x8000, 6, 5},
    {0x7fffffff, -0x80000000, 8, 0},
  
    /* call relaxing  */
--- 57,68 ----
  const relax_typeS md_relax_table[] = {
    /* bCC relaxing  */
    {0x7f, -0x80, 2, 1},
!   {0x7fff, -0x8000 + 1, 5, 2},
    {0x7fffffff, -0x80000000, 7, 0},
  
    /* bCC relaxing (uncommon cases)  */
    {0x7f, -0x80, 3, 4},
!   {0x7fff, -0x8000 + 1, 6, 5},
    {0x7fffffff, -0x80000000, 8, 0},
  
    /* call relaxing  */
*************** const relax_typeS md_relax_table[] = {
*** 80,86 ****
  
    /* fbCC relaxing  */
    {0x7f, -0x80, 3, 14},
!   {0x7fff, -0x8000, 6, 15},
    {0x7fffffff, -0x80000000, 8, 0},
  
  };
--- 80,86 ----
  
    /* fbCC relaxing  */
    {0x7f, -0x80, 3, 14},
!   {0x7fff, -0x8000 + 1, 6, 15},
    {0x7fffffff, -0x80000000, 8, 0},
  
  };
Index: gas/testsuite/gas/mn10300/basic.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mn10300/basic.exp,v
retrieving revision 1.9
diff -c -3 -p -r1.9 basic.exp
*** gas/testsuite/gas/mn10300/basic.exp	16 Jan 2004 03:16:07 -0000	1.9
--- gas/testsuite/gas/mn10300/basic.exp	12 Nov 2004 12:22:14 -0000
*************** if [istarget mn10300*-*-*] then {
*** 1817,1820 ****
--- 1817,1821 ----
      run_list_test "movpc" ""
  
      run_dump_test "am33-2"
+     run_dump_test "relax"
  }
Index: gas/testsuite/gas/mn10300/relax.s
===================================================================
0a1,32
> 	.am33_2
> 	
> 	.section .rlcb, "ax"
> 	.global relax_long_cond_branch
> relax_long_cond_branch:
> 	clr d0
> 	clr d1
> .L2:
> 	add d1,d0
> 	inc d1
> 
> 	.fill 32764, 1, 0xcb
> 
> 	cmp 9,d1
> 	ble .L2
> 	rets
> 	
> 
> 	.section .rsflb, "ax"
> 	.global relax_long_float_cond_branch
> relax_long_float_cond_branch:
> 	clr d0
> 	clr d1
> .L4:
> 	add d1,d0
> 	inc d1
> 
> 	.fill 32764, 1, 0xcb
> 
> 	cmp 9,d1
> 	fble .L4
> 	rets
Index: gas/testsuite/gas/mn10300/relax.d
===================================================================
0a1,17
> #objdump: -r 
> #name: Relaxation of conditional branches
> 
> .*: +file format.*elf32-[am33lin|mn10300].*
> 
> RELOCATION RECORDS FOR \[.rlcb\]:
> OFFSET   TYPE              VALUE 
> 0+8003 R_MN10300_PCREL8  .L0._0\+0x00000001
> 0+8005 R_MN10300_PCREL32  .L2\+0x00000001
> 
> 
> RELOCATION RECORDS FOR \[.rsflb\]:
> OFFSET   TYPE              VALUE 
> 0+8004 R_MN10300_PCREL8  .L0._1\+0x00000002
> 0+8006 R_MN10300_PCREL32  .L4\+0x00000001
> 
> 

  


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