python-dataproperty: bump version to 0.17.0
[buildroot-gz.git] / package / binutils / 2.25.1 / 905-Fix-trampolines-search-code-for-conditional-branches.patch
blob8aeb06428a4ad7273289ce7c3847180bc8657c01
1 From 415480d6471e67aef97c0241d451ef2423a1da9d Mon Sep 17 00:00:00 2001
2 From: Max Filippov <jcmvbkbc@gmail.com>
3 Date: Tue, 25 Nov 2014 21:33:21 +0300
4 Subject: [PATCH] Fix trampolines search code for conditional branches
6 For conditional branches that need more than one trampoline to reach its
7 target assembler couldn't always find suitable trampoline because
8 post-loop condition check was placed inside the loop, resulting in
9 premature loop termination. Move check outside the loop.
11 This fixes the following build errors seen when assembling huge files
12 produced by gcc:
13 Error: jump target out of range; no usable trampoline found
14 Error: operand 1 of 'j' has out of range value '307307'
16 2014-11-25 Max Filippov <jcmvbkbc@gmail.com>
18 gas/
19 * config/tc-xtensa.c (search_trampolines): Move post-loop
20 condition check outside the search loop.
22 gas/testsuite/
23 * gas/xtensa/trampoline.d: Add expected output for branches.
24 * gas/xtensa/trampoline.s: Add test case for branches.
26 Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
27 ---
28 Backported from: d92b6eece424f0ad35d96fdd85bf207295e8c4c3
29 Changes to ChangeLogs are dropped.
31 gas/config/tc-xtensa.c | 8 ++++----
32 gas/testsuite/gas/xtensa/trampoline.d | 9 +++++++++
33 gas/testsuite/gas/xtensa/trampoline.s | 7 +++++++
34 3 files changed, 20 insertions(+), 4 deletions(-)
36 diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
37 index d11b0c7..f23ccf8 100644
38 --- a/gas/config/tc-xtensa.c
39 +++ b/gas/config/tc-xtensa.c
40 @@ -9514,11 +9514,11 @@ search_trampolines (TInsn *tinsn, fragS *fragP, bfd_boolean unreachable_only)
41 if (next_addr == 0 || addr - next_addr > J_RANGE)
42 break;
44 - if (abs (addr - this_addr) < J_RANGE)
45 - return tf;
47 - return NULL;
49 + if (abs (addr - this_addr) < J_RANGE)
50 + return tf;
52 + return NULL;
54 for ( ; tf; tf = tf->next)
56 diff --git a/gas/testsuite/gas/xtensa/trampoline.d b/gas/testsuite/gas/xtensa/trampoline.d
57 index b4f65dc..5ae32a6 100644
58 --- a/gas/testsuite/gas/xtensa/trampoline.d
59 +++ b/gas/testsuite/gas/xtensa/trampoline.d
60 @@ -24,3 +24,12 @@
61 .*33462:.*j.0x49407
62 #...
63 .*49407:.*j.0x49407
64 +.*4940a:.*beqz.n.a2,.0x4940f
65 +.*4940c:.*j.0x693d1
66 +#...
67 +.*693d1:.*j.0x7ddd4
68 +#...
69 +.*7ddd4:.*j.0x927f5
70 +#...
71 +.*927f5:.*j.0x927f5
72 +#...
73 diff --git a/gas/testsuite/gas/xtensa/trampoline.s b/gas/testsuite/gas/xtensa/trampoline.s
74 index 259a3bb..4465786 100644
75 --- a/gas/testsuite/gas/xtensa/trampoline.s
76 +++ b/gas/testsuite/gas/xtensa/trampoline.s
77 @@ -19,3 +19,10 @@
78 .endr
80 j 3b
81 + bnez a2, 4f
82 + .rep 50000
83 + and a2, a2, a3
84 + _ret
85 + .endr
86 +4:
87 + j 4b
88 --
89 1.8.1.4