gas: xtensa: fix trampoline placement
authorMax Filippov <jcmvbkbc@gmail.com>
Sun, 11 Feb 2018 05:59:54 +0000 (21:59 -0800)
committerMax Filippov <jcmvbkbc@gmail.com>
Tue, 13 Feb 2018 17:32:47 +0000 (09:32 -0800)
For jumps requiring multiple trampolines trampoline placement code may
place multiple sequential trampolines into the same frag. Don't do that.

gas/
2018-02-13  Max Filippov  <jcmvbkbc@gmail.com>

* config/tc-xtensa.c (xg_find_best_trampoline): Skip trampoline
frag that contains source address.

gas/ChangeLog
gas/config/tc-xtensa.c

index adf45692eb693b76699b7808f889856fcec7cbbb..3d9b50fc329091020cafd9b6b02075a02146025b 100644 (file)
@@ -1,3 +1,8 @@
+2018-02-13  Max Filippov  <jcmvbkbc@gmail.com>
+
+       * config/tc-xtensa.c (xg_find_best_trampoline): Skip trampoline
+       frag that contains source address.
+
 2018-02-13  Nick Clifton  <nickc@redhat.com>
 
        PR 22773
index 58c2e10c1878f4b6bea92ba68232e068238db2e0..b522447b51313967a8e549ba21870cbb8ec7a497 100644 (file)
@@ -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