[PATCH v2] gas: xtensa: fix trampoline placement

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH v2] gas: xtensa: fix trampoline placement

Max Filippov
For jumps requiring multiple trampolines trampoline placement code may
place multiple sequential trampolines into the same frag. Don't do that.

gas/
2018-02-10  Max Filippov  <[hidden email]>

        * config/tc-xtensa.c (xg_find_best_trampoline): Skip trampoline
        frag that contains source address.
---
Changes v1->v2:
- change code formatting according to GNU coding standard

 gas/config/tc-xtensa.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index 58c2e10c1878..b522447b5131 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -9339,6 +9339,12 @@ static size_t xg_find_best_trampoline (struct trampoline_index *idx,
  trampoline_frag->fr_address > target))
       continue;
 
+    /* Don't choose trampoline that contains the source.  */
+    if (source >= trampoline_frag->fr_address
+ && source <= trampoline_frag->fr_address +
+ trampoline_frag->fr_fix)
+      continue;
+
     off = trampoline_frag->fr_address - fulcrum;
     /* Stop if some trampoline is found and the search is more than
        J_RANGE / 4 from the projected fulcrum.  A trampoline w/o jump
--
2.1.4

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v2] gas: xtensa: fix trampoline placement

Nick Clifton
Hi Max,

> gas/
> 2018-02-10  Max Filippov  <[hidden email]>
>
> * config/tc-xtensa.c (xg_find_best_trampoline): Skip trampoline
> frag that contains source address.

Approved - please apply.

Cheers
  Nick


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v2] gas: xtensa: fix trampoline placement

Max Filippov
On Tue, Feb 13, 2018 at 12:19 AM, Nick Clifton <[hidden email]> wrote:
> Hi Max,
>
>> gas/
>> 2018-02-10  Max Filippov  <[hidden email]>
>>
>>       * config/tc-xtensa.c (xg_find_best_trampoline): Skip trampoline
>>       frag that contains source address.
>
> Approved - please apply.

Thanks, applied to master.
I'd also like to apply it to the 2.30 branch, is it OK?

--
Thanks.
-- Max
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v2] gas: xtensa: fix trampoline placement

Nick Clifton
Hi Max,

>>>       * config/tc-xtensa.c (xg_find_best_trampoline): Skip trampoline
>>>       frag that contains source address.
>>
>> Approved - please apply.
>
> Thanks, applied to master.
> I'd also like to apply it to the 2.30 branch, is it OK?

That is fine, please go ahead.

Cheers
  Nick


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v2] gas: xtensa: fix trampoline placement

Max Filippov
On Wed, Feb 14, 2018 at 1:32 AM, Nick Clifton <[hidden email]> wrote:
>>>>       * config/tc-xtensa.c (xg_find_best_trampoline): Skip trampoline
>>>>       frag that contains source address.
>>>
>>> Approved - please apply.
>>
>> Thanks, applied to master.
>> I'd also like to apply it to the 2.30 branch, is it OK?
>
> That is fine, please go ahead.

Thanks, applied.

-- Max