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.ang...@bell.net


2014-08-11  John Dave Anglin  <dang...@gcc.gnu.org>

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

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)
        {

Reply via email to