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: Another MN10300 linker relaxation patch


Hi Guys,

  My previous patch to the MN10300 linker relaxation code overlooked
  the case of a backward branch just being in range, so I am applying
  the patch below to handle this.

Cheers
  Nick

bfd/ChangeLog
2007-11-28  Nick Clifton  <nickc@redhat.com>

	* elf-m10300.c (mn10300_elf_relax_section): Extend previous fix to
	cover forward jumps.

ld/testsuite/ChangeLog
2007-11-28  Nick Clifton  <nickc@redhat.com>

* ld-mn10300/i135409-5.s: New test case. Check for relaxation to
a 16-bit backward jump instruction.
* ld-mn10300/i135409-5.t: Linker script for the new test.
* ld-mn10300/i135409-5.d: Expected disassembly of new test.
* ld-mn10300/mn10300.exp: Run the new test.

Index: bfd/elf-m10300.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-m10300.c,v
retrieving revision 1.92
diff -c -3 -p -r1.92 elf-m10300.c
*** bfd/elf-m10300.c 21 Nov 2007 12:06:25 -0000 1.92
--- bfd/elf-m10300.c 28 Nov 2007 12:55:41 -0000
*************** mn10300_elf_relax_section (bfd *abfd,
*** 2963,2969 ****
able to relax. */
/* Account for jumps across alignment boundaries using
align_gap_adjustment. */
! if (value < 0x8001 - align_gap_adjustment
&& ((bfd_signed_vma) value > -0x8000 + (bfd_signed_vma) align_gap_adjustment))
{
unsigned char code;
--- 2963,2969 ----
able to relax. */
/* Account for jumps across alignment boundaries using
align_gap_adjustment. */
! if ((bfd_signed_vma) value < 0x8001 - (bfd_signed_vma) align_gap_adjustment
&& ((bfd_signed_vma) value > -0x8000 + (bfd_signed_vma) align_gap_adjustment))
{
unsigned char code;
Index: ld/testsuite/ld-mn10300/mn10300.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-mn10300/mn10300.exp,v
retrieving revision 1.5
diff -c -3 -p -r1.5 mn10300.exp
*** ld/testsuite/ld-mn10300/mn10300.exp 21 Nov 2007 12:06:26 -0000 1.5
--- ld/testsuite/ld-mn10300/mn10300.exp 28 Nov 2007 12:55:41 -0000
*************** set mn10300_tests {
*** 80,92 ****
"i135409-3.x"
}
{
! "adjusting a 16 bit branch"
"-Ti135409-4.t -relax"
""
{ "i135409-4.s" }
{ {objdump -d i135409-4.d} }
"i135409-4.x"
}
}


  run_ld_link_tests $mn10300_tests
--- 80,100 ----
  	"i135409-3.x"
      }
      {
! 	"adjusting a 16-bit forward branch"
  	"-Ti135409-4.t -relax"
  	""
  	{ "i135409-4.s" }
  	{ {objdump -d i135409-4.d} }
  	"i135409-4.x"
      }
+     {
+ 	"adjusting a 16-bit backward branch"
+ 	"-Ti135409-5.t -relax"
+ 	""
+ 	{ "i135409-5.s" }
+ 	{ {objdump -d i135409-5.d} }
+ 	"i135409-5.x"
+     }
  }

run_ld_link_tests $mn10300_tests

*** /dev/null	2007-11-26 08:41:04.728825040 +0000
--- ld/testsuite/ld-mn10300/i135409-5.s	2007-11-26 13:14:18.000000000 +0000
***************
*** 0 ****
--- 1,8 ----
+ 	.text
+        .global _start
+ _start:
+        jmp     L001
+
+        .section        .text1
+ L001:
+        nop
*** /dev/null	2007-11-26 08:41:04.728825040 +0000
--- ld/testsuite/ld-mn10300/i135409-5.t	2007-11-26 13:14:18.000000000 +0000
***************
*** 0 ****
--- 1,23 ----
+ SECTIONS
+ {
+        . = 0x0;
+        .text1 :
+        {
+                *(.text1)
+        }
+
+        . = 0x700;
+        .text :
+        {
+                *(.text)
+        }
+        . = 0x8100;
+        .bss :
+        {
+                *(.bss)
+        }
+        .data :
+        {
+                *(.data)
+        }
+ }
*** /dev/null	2007-11-26 08:41:04.728825040 +0000
--- ld/testsuite/ld-mn10300/i135409-5.d	2007-11-26 13:14:18.000000000 +0000
***************
*** 0 ****
--- 1,7 ----
+
+ tmpdir/i135409-5.x:     file format elf32-.*
+
+ Disassembly of section .text:
+
+ 0+0700 <_start>:
+  700:[ 	]+cc 00 f9[ 	]+jmp[ 	]+0 \<L001\>


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