This is the mail archive of the binutils-cvs@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]

[binutils-gdb/binutils-2_25-branch] [AArch64] Fix branch stubs for BE


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b4437893f70ded21c80200149bcfd5495eed9eea

commit b4437893f70ded21c80200149bcfd5495eed9eea
Author: Tejas Belagod <tejas.belagod@arm.com>
Date:   Fri Mar 27 09:12:48 2015 +0000

    [AArch64] Fix branch stubs for BE
    
    2015-03-26  Tejas Belagod  <tejas.belagod@arm.com>
    
    bfd/
      * elfnn-aarch64.c (aarch64_build_one_stub): Replace the call to generic
      _bfd_final_link_relocate with aarch64_relocate.
    
    ld/testsuite
      * ld-aarch64/farcall-back-be.d: New.

Diff:
---
 bfd/ChangeLog                             |  5 +++
 bfd/elfnn-aarch64.c                       | 19 +++-----
 ld/testsuite/ChangeLog                    |  4 ++
 ld/testsuite/ld-aarch64/farcall-back-be.d | 74 +++++++++++++++++++++++++++++++
 4 files changed, 89 insertions(+), 13 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index c54b53a..15e957a 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-26  Tejas Belagod  <tejas.belagod@arm.com>
+
+	* elfnn-aarch64.c (aarch64_build_one_stub): Replace the call to generic
+	_bfd_final_link_relocate with aarch64_relocate.
+
 2015-03-25  Nick Clifton  <nickc@redhat.com>
 
 	Apply from master:
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 302e8cb..f23afb5 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -2452,24 +2452,17 @@ aarch64_build_one_stub (struct bfd_hash_entry *gen_entry,
 	   of range.  */
 	BFD_FAIL ();
 
-      _bfd_final_link_relocate
-	(elfNN_aarch64_howto_from_type (AARCH64_R (ADD_ABS_LO12_NC)),
-	 stub_bfd,
-	 stub_sec,
-	 stub_sec->contents,
-	 stub_entry->stub_offset + 4,
-	 sym_value,
-	 0);
+      if (aarch64_relocate (AARCH64_R (ADD_ABS_LO12_NC), stub_bfd, stub_sec,
+			    stub_entry->stub_offset + 4, sym_value))
+	BFD_FAIL ();
       break;
 
     case aarch64_stub_long_branch:
       /* We want the value relative to the address 12 bytes back from the
          value itself.  */
-      _bfd_final_link_relocate (elfNN_aarch64_howto_from_type
-				(AARCH64_R (PRELNN)), stub_bfd, stub_sec,
-				stub_sec->contents,
-				stub_entry->stub_offset + 16,
-				sym_value + 12, 0);
+      if (aarch64_relocate (AARCH64_R (PRELNN), stub_bfd, stub_sec,
+			    stub_entry->stub_offset + 16, sym_value + 12))
+	BFD_FAIL ();
       break;
 
     case aarch64_stub_erratum_835769_veneer:
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index c7cfe59..a2ac713 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2015-03-26  Tejas Belagod  <tejas.belagod@arm.com>
+
+	* ld-aarch64/farcall-back-be.d: New.
+
 2015-03-18  Alan Modra  <amodra@gmail.com>
 
 	Apply from master
diff --git a/ld/testsuite/ld-aarch64/farcall-back-be.d b/ld/testsuite/ld-aarch64/farcall-back-be.d
new file mode 100644
index 0000000..80992aa
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/farcall-back-be.d
@@ -0,0 +1,74 @@
+#name: aarch64-farcall-back-be
+#source: farcall-back.s
+#as:
+#ld: -Ttext 0x1000 --section-start .foo=0x100000000
+#objdump: -dr
+#target: aarch64_be-*-*
+#...
+
+Disassembly of section .text:
+
+0000000000001000 <_start>:
+    1000:	14000413 	b	204c <__bar1_veneer>
+    1004:	94000412 	bl	204c <__bar1_veneer>
+    1008:	14000407 	b	2024 <__bar2_veneer>
+    100c:	94000406 	bl	2024 <__bar2_veneer>
+    1010:	14000409 	b	2034 <__bar3_veneer>
+    1014:	94000408 	bl	2034 <__bar3_veneer>
+    1018:	d65f03c0 	ret
+	...
+
+000000000000201c <_back>:
+    201c:	d65f03c0 	ret
+
+[ \t]+2020:[ \t]+14000013[ \t]+b[ \t]+206c <__bar1_veneer\+0x20>
+0000000000002024 <__bar2_veneer>:
+    2024:	f07ffff0 	adrp	x16, 100001000 <bar1\+0x1000>
+    2028:	91002210 	add	x16, x16, #0x8
+    202c:	d61f0200 	br	x16
+    2030:	00000000 	.inst	0x00000000 ; undefined
+
+0000000000002034 <__bar3_veneer>:
+    2034:	58000090 	ldr	x16, 2044 <__bar3_veneer\+0x10>
+    2038:	10000011 	adr	x17, 2038 <__bar3_veneer\+0x4>
+    203c:	8b110210 	add	x16, x16, x17
+    2040:	d61f0200 	br	x16
+    2044:	00000000 	.word	0x00000000
+    2048:	ffffffd8 	.word	0xffffffd8
+
+000000000000204c <__bar1_veneer>:
+    204c:	d07ffff0 	adrp	x16, 100000000 <bar1>
+    2050:	91000210 	add	x16, x16, #0x0
+    2054:	d61f0200 	br	x16
+	...
+
+Disassembly of section .foo:
+
+0000000100000000 <bar1>:
+   100000000:	d65f03c0 	ret
+   100000004:	14000806 	b	10000201c <___start_veneer>
+	...
+
+0000000100001008 <bar2>:
+   100001008:	d65f03c0 	ret
+   10000100c:	14000404 	b	10000201c <___start_veneer>
+	...
+
+0000000100002010 <bar3>:
+   100002010:	d65f03c0 	ret
+   100002014:	14000008 	b	100002034 <___back_veneer>
+
+[ \t]+100002018:[ \t]+1400000d[ \t]+b[ \t]+10000204c <___back_veneer\+0x18>
+000000010000201c <___start_veneer>:
+   10000201c:	58000090 	ldr	x16, 10000202c <___start_veneer\+0x10>
+   100002020:	10000011 	adr	x17, 100002020 <___start_veneer\+0x4>
+   100002024:	8b110210 	add	x16, x16, x17
+   100002028:	d61f0200 	br	x16
+   10000202c:	fffffffe 	.word	0xfffffffe
+   100002030:	ffffefe0 	.word	0xffffefe0
+
+0000000100002034 <___back_veneer>:
+   100002034:	90800010 	adrp	x16, 2000 <_start\+0x1000>
+   100002038:	91007210 	add	x16, x16, #0x1c
+   10000203c:	d61f0200 	br	x16
+	...


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