Fix trampolines search code for conditional branches
authorMax Filippov <jcmvbkbc@gmail.com>
Tue, 25 Nov 2014 18:33:21 +0000 (21:33 +0300)
committerMax Filippov <jcmvbkbc@gmail.com>
Tue, 25 Nov 2014 21:17:36 +0000 (00:17 +0300)
For conditional branches that need more than one trampoline to reach its
target assembler couldn't always find suitable trampoline because
post-loop condition check was placed inside the loop, resulting in
premature loop termination. Move check outside the loop.

This fixes the following build errors seen when assembling huge files
produced by gcc:
    Error: jump target out of range; no usable trampoline found
    Error: operand 1 of 'j' has out of range value '307307'

2014-11-25  Max Filippov  <jcmvbkbc@gmail.com>

gas/
* config/tc-xtensa.c (search_trampolines): Move post-loop
condition check outside the search loop.

gas/testsuite/
* gas/xtensa/trampoline.d: Add expected output for branches.
* gas/xtensa/trampoline.s: Add test case for branches.

gas/ChangeLog
gas/config/tc-xtensa.c
gas/testsuite/ChangeLog
gas/testsuite/gas/xtensa/trampoline.d
gas/testsuite/gas/xtensa/trampoline.s

index 757ef4b7b5ec0d2caa9d9a0ff95909198562bdb8..b0119c6f6ef6906bbeb3657f505fccf04ec0c809 100644 (file)
@@ -1,3 +1,8 @@
+2014-11-25  Max Filippov  <jcmvbkbc@gmail.com>
+
+       * config/tc-xtensa.c (search_trampolines): Move post-loop
+       condition check outside the search loop.
+
 2014-11-24  H.J. Lu  <hongjiu.lu@intel.com>
 
        * configure: Regenerated.
index d11b0c7f27e74e7d7d5a185833abc88654b1c698..f23ccf81a28c9428782747e1089c05ce75607ecf 100644 (file)
@@ -9514,11 +9514,11 @@ search_trampolines (TInsn *tinsn, fragS *fragP, bfd_boolean unreachable_only)
              if (next_addr == 0 || addr - next_addr > J_RANGE)
                break;
            }
-         if (abs (addr - this_addr) < J_RANGE)
-           return tf;
-
-         return NULL;
        }
+      if (abs (addr - this_addr) < J_RANGE)
+       return tf;
+
+      return NULL;
     }
   for ( ; tf; tf = tf->next)
     {
index 00a2df036dd4857082be06e5a0ad139a07ea6b92..3c2f81a6bbdb9c7779da94390a7c90a5328a814e 100644 (file)
@@ -1,3 +1,7 @@
+2014-11-25  Max Filippov  <jcmvbkbc@gmail.com>
+       * gas/xtensa/trampoline.d: Add expected output for branches.
+       * gas/xtensa/trampoline.s: Add test case for branches.
+
 2014-11-21  Terry Guo  <terry.guo@arm.com>
 
        * gas/arm/attr-arch-assumption.d: New file.
index b4f65dc8c73980740f669e1806d2fdd75f6c1fec..5ae32a66b8410599cf72b331620d688e83110f23 100644 (file)
 .*33462:.*j.0x49407
 #...
 .*49407:.*j.0x49407
+.*4940a:.*beqz.n.a2,.0x4940f
+.*4940c:.*j.0x693d1
+#...
+.*693d1:.*j.0x7ddd4
+#...
+.*7ddd4:.*j.0x927f5
+#...
+.*927f5:.*j.0x927f5
+#...
index 259a3bbedcfb06aecc7fd0bad9e82ed170b43768..4465786bb06d0b6c544b97fbd2066cb5fec1ad57 100644 (file)
        .endr
 3:
        j       3b
+       bnez    a2, 4f
+       .rep    50000
+       and     a2, a2, a3
+       _ret
+       .endr
+4:
+       j       4b
This page took 0.030968 seconds and 4 git commands to generate.