diff mbox

[committed] Use branch with link register for jump from thunk

Message ID BLU436-SMTP230D13A3861CD380090901297ED0@phx.gbl
State New
Headers show

Commit Message

John David Anglin Aug. 11, 2014, 7:24 p.m. UTC
With a large function, the 'b' branch may not be able to reach its  
target without a long branch stub.  Gas doesn't provide
a long branch stub for a branch without a link register (i.e., it  
considers branches with link registers calls).  This patch
changes pa_asm_output_mi_thunk() to use a bl branch so the linker will  
provide a long branch stub if needed.

Tested on hppa-unknown-linux-gnu, hppa2.0w-hp-hpux11.11 and hppa64-hp- 
hpux11.11 with no observed regressions.
Committed to trunk, 4.9 and 4.8.

Dave
--
John David Anglin	dave.anglin@bell.net
2014-08-11  John Dave Anglin  <danglin@gcc.gnu.org>

	PR target/62038
	* config/pa/pa.c (pa_asm_output_mi_thunk): Use a branch with %r31 link
	register.

Comments

John David Anglin Aug. 11, 2014, 7:57 p.m. UTC | #1
On 11-Aug-14, at 3:24 PM, John David Anglin wrote:

> Tested on hppa-unknown-linux-gnu, hppa2.0w-hp-hpux11.11 and hppa64- 
> hp-hpux11.11 with no observed regressions.
> Committed to trunk, 4.9 and 4.8.

There is a problem...

Patch reverted.

Dave
--
John David Anglin	dave.anglin@bell.net
diff mbox

Patch

Index: config/pa/pa.c
===================================================================
--- config/pa/pa.c	(revision 213683)
+++ config/pa/pa.c	(working copy)
@@ -8285,7 +8287,9 @@ 
       if (!val_14)
 	output_asm_insn ("addil L'%2,%%r26", xoperands);
 
-      output_asm_insn ("b %0", xoperands);
+      /* An absolute branch without a link register is not considered
+	 a call by GAS.  We need a call to get a stub if necessary.  */
+      output_asm_insn ("bl %0,%%r31", xoperands);
 
       if (val_14)
 	{