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]

ARM long branch stub: thumb


Hi,

Another small set of fixes in the ARM long branch stubs: this patch makes use of the "Thumb mode only" stub in cases where the BLX instruction is not available.

It includes fixes in the testsuite:
- 2 non-EABI tests now expected to pass
- one EABI test now expected to pass
- a few of the XFAIL tests had incorrect name and/or ld flags, so I fixed this.


In arm-elf.exp, I changed the address of section .foo (was 0x40100c, now 0x100100c) to have it be the same in EABI and non-EABI tests, and because in the non-EABI case, it was not far enough to need the stub (more precisely, after inserting the stub, the call point became close enough to its target).

Christophe.
2009-02-19  Christophe Lyon  <christophe.lyon@st.com>

	bfd/
	* elf32-arm.c (arm_type_of_stub): Use Thumb-only long branch
	stub (non-PIC) when BLX is not available. Fix typo in warning
	message.

	testsuite/
	* ld-arm/arm-elf.exp: Rewrite non-EABI variants of
	thumb2-bl-as-thumb1-bad and thumb2-bl-bad tests, which now
	pass. farcall-thumb-thumb now passes in EABI mode.
	* ld-arm/farcall-thumb-arm-pic-veneer.d: Fixed name, source, as
	and ld flags to match intended test.
	* ld-arm/farcall-thumb-thumb-m-pic-veneer.d: Fixed name and ld
	flags.
	* ld-arm/farcall-thumb-thumb-pic-veneer.d: Likewise.
	* ld-arm/farcall-thumb-thumb.d: New expected result, this test is
	now expected to pass.
	* ld-arm/thumb2-bl-as-thumb1-bad-noeabi.d: Likewise.
	* ld-arm/thumb2-bl-bad-noeabi.d: Likewise.
	* ld-arm/thumb2-bl-as-thumb1-bad.d: Update addresses according to
	new use.
	* ld-arm/thumb2-bl-as-thumb1-bad.s: Update comment.
diff -uN -r --exclude=CVS --exclude='*~' --exclude='.#*' binutils-cvs-ref/src/bfd/elf32-arm.c binutils-mycvs/src/bfd/elf32-arm.c
--- binutils-cvs-ref/src/bfd/elf32-arm.c	2009-02-18 17:59:54.000000000 +0100
+++ binutils-mycvs/src/bfd/elf32-arm.c	2009-02-19 15:50:12.000000000 +0100
@@ -2824,15 +2824,13 @@
 		       : arm_stub_none)
 		    : (globals->use_blx)
 		    ? arm_stub_long_branch_any_any
-		    : arm_stub_none;
+		    : arm_stub_long_branch_thumb_only;
 		}
 	      else
 		{
 		  stub_type = (info->shared | globals->pic_veneer)
 		    ? arm_stub_none
-		    : (globals->use_blx)
-		    ? arm_stub_long_branch_thumb_only
-		    : arm_stub_none;
+		    : arm_stub_long_branch_thumb_only;
 		}
 	    }
 	  else
@@ -2876,7 +2874,7 @@
 	    {
 	      (*_bfd_error_handler)
 		(_("%B(%s): warning: interworking not enabled.\n"
-		   "  first occurrence: %B: Thumb call to ARM"),
+		   "  first occurrence: %B: ARM call to Thumb"),
 		 sym_sec->owner, input_bfd, name);
 	    }
 
diff -uN -r --exclude=CVS --exclude='*~' --exclude='.#*' binutils-cvs-ref/src/ld/testsuite/ld-arm/arm-elf.exp binutils-mycvs/src/ld/testsuite/ld-arm/arm-elf.exp
--- binutils-cvs-ref/src/ld/testsuite/ld-arm/arm-elf.exp	2009-02-16 12:56:34.000000000 +0100
+++ binutils-mycvs/src/ld/testsuite/ld-arm/arm-elf.exp	2009-02-19 17:26:13.000000000 +0100
@@ -190,10 +190,20 @@
 # Exclude non-ARM-EABI targets.
 
 if { ![istarget "arm*-*-*eabi"] } {
-    # Special variants of these tests, as no farcall stub is generated
-    # for a non-ARM-EABI target
-    run_dump_test "thumb2-bl-as-thumb1-bad-noeabi"
-    run_dump_test "thumb2-bl-bad-noeabi"
+    # Special variants of these tests, as a different farcall stub is
+    # generated for a non-ARM-EABI target: indeed in such a case,
+    # there are no attributes to indicate that blx can be used.
+
+    set arm_noeabi_tests {
+	{"Thumb-2-as-Thumb-1 BL" "-Ttext 0x1000 --section-start .foo=0x100100c" "" {thumb2-bl-as-thumb1-bad.s}
+	    {{objdump -d thumb2-bl-as-thumb1-bad-noeabi.d}}
+	    "thumb2-bl-as-thumb1-bad"}
+	{"Thumb-2 BL" "-Ttext 0x1000 --section-start .foo=0x100100c" "" {thumb2-bl-bad.s}
+	    {{objdump -d thumb2-bl-bad-noeabi.d}}
+	    "thumb2-bl-bad"}
+    }
+    run_ld_link_tests $arm_noeabi_tests
+
     return
 }
 
@@ -241,7 +251,7 @@
     {"MOVW/MOVT against shared libraries" "tmpdir/arm-lib.so" "" {arm-app-movw.s}
      {{objdump -Rw arm-app.r}}
      "arm-app-movw"}
-    {"Thumb-2-as-Thumb-1 BL" "-Ttext 0x1000 --section-start .foo=0x40100c" "" {thumb2-bl-as-thumb1-bad.s}
+    {"Thumb-2-as-Thumb-1 BL" "-Ttext 0x1000 --section-start .foo=0x100100c" "" {thumb2-bl-as-thumb1-bad.s}
      {{objdump -d thumb2-bl-as-thumb1-bad.d}}
      "thumb2-bl-as-thumb1-bad"}
     {"Thumb-2 BL" "-Ttext 0x1000 --section-start .foo=0x100100c" "" {thumb2-bl-bad.s}
@@ -277,6 +287,9 @@
     {"Thumb-Thumb farcall M profile" "-Ttext 0x1000 --section-start .foo=0x2001014" "-march=armv7m" {farcall-thumb-thumb.s}
      {{objdump -d farcall-thumb-thumb-m.d}}
      "farcall-thumb-thumb-m"}
+    {"Thumb-Thumb farcall" "-Ttext 0x1000 --section-start .foo=0x2001014" "-march=armv4t" {farcall-thumb-thumb.s}
+     {{objdump -d farcall-thumb-thumb.d}}
+     "farcall-thumb-thumb"}
     {"Thumb-Thumb farcall with BLX (PIC veneer)" "-Ttext 0x1000 --section-start .foo=0x2001014 --pic-veneer" "-march=armv5t" {farcall-thumb-thumb.s}
      {{objdump -d farcall-thumb-thumb-blx-pic-veneer.d}}
      "farcall-thumb-thumb-blx-pic-veneer"}
@@ -328,7 +341,6 @@
 run_dump_test "attr-merge-wchar-40-nowarn"
 run_dump_test "attr-merge-wchar-42-nowarn"
 run_dump_test "attr-merge-wchar-44-nowarn"
-run_dump_test "farcall-thumb-thumb"
 run_dump_test "farcall-thumb-thumb-pic-veneer"
 run_dump_test "farcall-thumb-thumb-m-pic-veneer"
 run_dump_test "farcall-thumb-arm-pic-veneer"
diff -uN -r --exclude=CVS --exclude='*~' --exclude='.#*' binutils-cvs-ref/src/ld/testsuite/ld-arm/farcall-thumb-arm-pic-veneer.d binutils-mycvs/src/ld/testsuite/ld-arm/farcall-thumb-arm-pic-veneer.d
--- binutils-cvs-ref/src/ld/testsuite/ld-arm/farcall-thumb-arm-pic-veneer.d	2008-05-15 19:00:15.000000000 +0200
+++ binutils-mycvs/src/ld/testsuite/ld-arm/farcall-thumb-arm-pic-veneer.d	2009-02-19 16:09:19.000000000 +0100
@@ -1,5 +1,5 @@
-#name: Thumb-Thumb farcall without BLX
-#source: farcall-thumb-thumb.s
-#as: -march=armv4t
-#ld: -Ttext 0x1000 --section-start .foo=0x2001014
+#name: Thumb-ARM farcall without BLX (PIC veneer)
+#source: farcall-thumb-arm.s
+#as: -march=armv4t -W
+#ld: -Ttext 0x1000 --section-start .foo=0x2001014 --pic-veneer
 #error: .*\(.text\+0x0\): relocation truncated to fit: R_ARM_THM_CALL against `bar'
diff -uN -r --exclude=CVS --exclude='*~' --exclude='.#*' binutils-cvs-ref/src/ld/testsuite/ld-arm/farcall-thumb-thumb-m-pic-veneer.d binutils-mycvs/src/ld/testsuite/ld-arm/farcall-thumb-thumb-m-pic-veneer.d
--- binutils-cvs-ref/src/ld/testsuite/ld-arm/farcall-thumb-thumb-m-pic-veneer.d	2008-05-15 19:00:15.000000000 +0200
+++ binutils-mycvs/src/ld/testsuite/ld-arm/farcall-thumb-thumb-m-pic-veneer.d	2009-02-19 16:10:00.000000000 +0100
@@ -1,5 +1,5 @@
-#name: Thumb-Thumb farcall without BLX
+#name: Thumb-Thumb farcall M profile (PIC veneer)
 #source: farcall-thumb-thumb.s
 #as: -march=armv4t
-#ld: -Ttext 0x1000 --section-start .foo=0x2001014
+#ld: -Ttext 0x1000 --section-start .foo=0x2001014 --pic-veneer
 #error: .*\(.text\+0x0\): relocation truncated to fit: R_ARM_THM_CALL against `bar'
diff -uN -r --exclude=CVS --exclude='*~' --exclude='.#*' binutils-cvs-ref/src/ld/testsuite/ld-arm/farcall-thumb-thumb-pic-veneer.d binutils-mycvs/src/ld/testsuite/ld-arm/farcall-thumb-thumb-pic-veneer.d
--- binutils-cvs-ref/src/ld/testsuite/ld-arm/farcall-thumb-thumb-pic-veneer.d	2008-05-15 19:00:15.000000000 +0200
+++ binutils-mycvs/src/ld/testsuite/ld-arm/farcall-thumb-thumb-pic-veneer.d	2009-02-19 16:10:13.000000000 +0100
@@ -1,5 +1,5 @@
-#name: Thumb-Thumb farcall without BLX
+#name: Thumb-Thumb farcall without BLX (PIC veneer)
 #source: farcall-thumb-thumb.s
 #as: -march=armv4t
-#ld: -Ttext 0x1000 --section-start .foo=0x2001014
+#ld: -Ttext 0x1000 --section-start .foo=0x2001014 --pic-veneer
 #error: .*\(.text\+0x0\): relocation truncated to fit: R_ARM_THM_CALL against `bar'
diff -uN -r --exclude=CVS --exclude='*~' --exclude='.#*' binutils-cvs-ref/src/ld/testsuite/ld-arm/farcall-thumb-thumb.d binutils-mycvs/src/ld/testsuite/ld-arm/farcall-thumb-thumb.d
--- binutils-cvs-ref/src/ld/testsuite/ld-arm/farcall-thumb-thumb.d	2008-05-15 19:00:15.000000000 +0200
+++ binutils-mycvs/src/ld/testsuite/ld-arm/farcall-thumb-thumb.d	2009-02-19 15:56:10.000000000 +0100
@@ -1,5 +1,19 @@
-#name: Thumb-Thumb farcall without BLX
-#source: farcall-thumb-thumb.s
-#as: -march=armv4t
-#ld: -Ttext 0x1000 --section-start .foo=0x2001014
-#error: .*\(.text\+0x0\): relocation truncated to fit: R_ARM_THM_CALL against `bar'
+.*:     file format .*
+
+Disassembly of section .text:
+
+00001000 <__bar_veneer>:
+    1000:	b540      	push	{r6, lr}
+    1002:	4e02      	ldr	r6, \[pc, #8\]	\(100c <__bar_veneer\+0xc>\)
+    1004:	46fe      	mov	lr, pc
+    1006:	4730      	bx	r6
+    1008:	bd40      	pop	{r6, pc}
+    100a:	bf00      	nop
+    100c:	02001015 	.word	0x02001015
+
+00001010 <_start>:
+    1010:	f7ff fff6 	bl	1000 <__bar_veneer>
+Disassembly of section .foo:
+
+02001014 <bar>:
+ 2001014:	4770      	bx	lr
diff -uN -r --exclude=CVS --exclude='*~' --exclude='.#*' binutils-cvs-ref/src/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad-noeabi.d binutils-mycvs/src/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad-noeabi.d
--- binutils-cvs-ref/src/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad-noeabi.d	2008-05-31 18:04:57.000000000 +0200
+++ binutils-mycvs/src/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad-noeabi.d	2009-02-19 17:20:49.000000000 +0100
@@ -1,4 +1,19 @@
-#name: Thumb-2-as-Thumb-1 BL failure test
-#source: thumb2-bl-as-thumb1-bad.s
-#ld: -Ttext 0x1000 --section-start .foo=0x401004
-#error: .*\(.text\+0x0\): relocation truncated to fit: R_ARM_THM_CALL against `bar'
+.*:     file format .*
+
+Disassembly of section .text:
+
+00001000 <__bar_veneer>:
+    1000:	b540      	push	{r6, lr}
+    1002:	4e02      	ldr	r6, \[pc, #8\]	\(100c <__bar_veneer\+0xc>\)
+    1004:	46fe      	mov	lr, pc
+    1006:	4730      	bx	r6
+    1008:	bd40      	pop	{r6, pc}
+    100a:	bf00      	nop
+    100c:	0100100d 	.word	0x0100100d
+
+00001010 <_start>:
+    1010:	f7ff fff6 	bl	1000 <__bar_veneer>
+Disassembly of section .foo:
+
+0100100c <bar>:
+ 100100c:	4770      	bx	lr
diff -uN -r --exclude=CVS --exclude='*~' --exclude='.#*' binutils-cvs-ref/src/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.d binutils-mycvs/src/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.d
--- binutils-cvs-ref/src/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.d	2008-06-25 16:28:48.000000000 +0200
+++ binutils-mycvs/src/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.d	2009-02-19 17:28:38.000000000 +0100
@@ -4,11 +4,11 @@
 
 00001000 <__bar_veneer>:
     1000:	e51ff004 	ldr	pc, \[pc, #-4\]	; 1004 <__bar_veneer\+0x4>
-    1004:	0040100d 	.word	0x0040100d
+    1004:	0100100d 	.word	0x0100100d
 
 00001008 <_start>:
     1008:	f7ff effa 	blx	1000 <__bar_veneer>
 Disassembly of section .foo:
 
-0040100c <bar>:
-  40100c:	4770      	bx	lr
+0100100c <bar>:
+ 100100c:	4770      	bx	lr
diff -uN -r --exclude=CVS --exclude='*~' --exclude='.#*' binutils-cvs-ref/src/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.s binutils-mycvs/src/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.s
--- binutils-cvs-ref/src/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.s	2008-05-15 19:00:15.000000000 +0200
+++ binutils-mycvs/src/ld/testsuite/ld-arm/thumb2-bl-as-thumb1-bad.s	2009-02-19 17:25:33.000000000 +0100
@@ -12,7 +12,7 @@
 _start:
 	bl bar
 
-@ We will place the section .foo at 0x40100c.
+@ We will place the section .foo at 0x100100c.
 
 	.section .foo, "xa"
 	.thumb_func
diff -uN -r --exclude=CVS --exclude='*~' --exclude='.#*' binutils-cvs-ref/src/ld/testsuite/ld-arm/thumb2-bl-bad-noeabi.d binutils-mycvs/src/ld/testsuite/ld-arm/thumb2-bl-bad-noeabi.d
--- binutils-cvs-ref/src/ld/testsuite/ld-arm/thumb2-bl-bad-noeabi.d	2008-05-31 18:04:57.000000000 +0200
+++ binutils-mycvs/src/ld/testsuite/ld-arm/thumb2-bl-bad-noeabi.d	2009-02-19 17:20:11.000000000 +0100
@@ -1,4 +1,19 @@
-#name: Thumb-2 BL failure test
-#source: thumb2-bl-bad.s
-#ld: -Ttext 0x1000 --section-start .foo=0x1001004
-#error: .*\(.text\+0x0\): relocation truncated to fit: R_ARM_THM_CALL against `bar'
+.*:     file format .*
+
+Disassembly of section .text:
+
+00001000 <__bar_veneer>:
+    1000:	b540      	push	{r6, lr}
+    1002:	4e02      	ldr	r6, \[pc, #8\]	\(100c <__bar_veneer\+0xc>\)
+    1004:	46fe      	mov	lr, pc
+    1006:	4730      	bx	r6
+    1008:	bd40      	pop	{r6, pc}
+    100a:	bf00      	nop
+    100c:	0100100d 	.word	0x0100100d
+
+00001010 <_start>:
+    1010:	f7ff fff6 	bl	1000 <__bar_veneer>
+Disassembly of section .foo:
+
+0100100c <bar>:
+ 100100c:	4770      	bx	lr

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