aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2014-11-25 21:33:21 +0300
committerMax Filippov <jcmvbkbc@gmail.com>2014-11-26 00:17:36 +0300
commitd92b6eece424f0ad35d96fdd85bf207295e8c4c3 (patch)
treefd0ea7b82607c32bc16c4c000b2a85e2e3e31dd2 /gas
parent60bb06bc89858ee50ad02907a833565dcc317182 (diff)
downloadgdb-d92b6eece424f0ad35d96fdd85bf207295e8c4c3.zip
gdb-d92b6eece424f0ad35d96fdd85bf207295e8c4c3.tar.gz
gdb-d92b6eece424f0ad35d96fdd85bf207295e8c4c3.tar.bz2
Fix trampolines search code for conditional branches
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.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-xtensa.c8
-rw-r--r--gas/testsuite/ChangeLog4
-rw-r--r--gas/testsuite/gas/xtensa/trampoline.d9
-rw-r--r--gas/testsuite/gas/xtensa/trampoline.s7
5 files changed, 29 insertions, 4 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 757ef4b..b0119c6 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -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.
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index d11b0c7..f23ccf8 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -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)
{
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 00a2df0..3c2f81a 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -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.
diff --git a/gas/testsuite/gas/xtensa/trampoline.d b/gas/testsuite/gas/xtensa/trampoline.d
index b4f65dc..5ae32a6 100644
--- a/gas/testsuite/gas/xtensa/trampoline.d
+++ b/gas/testsuite/gas/xtensa/trampoline.d
@@ -24,3 +24,12 @@
.*33462:.*j.0x49407
#...
.*49407:.*j.0x49407
+.*4940a:.*beqz.n.a2,.0x4940f
+.*4940c:.*j.0x693d1
+#...
+.*693d1:.*j.0x7ddd4
+#...
+.*7ddd4:.*j.0x927f5
+#...
+.*927f5:.*j.0x927f5
+#...
diff --git a/gas/testsuite/gas/xtensa/trampoline.s b/gas/testsuite/gas/xtensa/trampoline.s
index 259a3bb..4465786 100644
--- a/gas/testsuite/gas/xtensa/trampoline.s
+++ b/gas/testsuite/gas/xtensa/trampoline.s
@@ -19,3 +19,10 @@
.endr
3:
j 3b
+ bnez a2, 4f
+ .rep 50000
+ and a2, a2, a3
+ _ret
+ .endr
+4:
+ j 4b