gas: xtensa: fix trampoline placement

Message ID 1518394481-6214-1-git-send-email-jcmvbkbc@gmail.com
State Superseded
Headers show
Series
  • gas: xtensa: fix trampoline placement
Related show

Commit Message

Max Filippov Feb. 12, 2018, 12:14 a.m.
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  <jcmvbkbc@gmail.com>

	* config/tc-xtensa.c (xg_find_best_trampoline): Skip trampoline
	frag that contains source address.
---
 gas/config/tc-xtensa.c | 5 +++++
 1 file changed, 5 insertions(+)

-- 
2.1.4

Comments

Nick Clifton Feb. 12, 2018, 12:08 p.m. | #1
Hi Max,

  Would you mind updating your recent commits please ?

> +	    /* Don't choose trampoline that contains the source.  */

> +	    if (source >= trampoline_frag->fr_address &&

> +		source <= trampoline_frag->fr_address + trampoline_frag->fr_fix)

> +	      continue;


  The GNU Coding standard requires that boolean conditional 
  operators should be at the start of a line, not the end:

https://www.gnu.org/prep/standards/html_node/Formatting.html#Formatting

  So the above fragment, for example, should be:

	    /* Don't choose trampoline that contains the source.  */
	    if (source >= trampoline_frag->fr_address
		&& source <= trampoline_frag->fr_address + trampoline_frag->fr_fix)
	      continue;

  Thanks.

Cheers
  Nick
Max Filippov Feb. 12, 2018, 5:11 p.m. | #2
Hi Nick,

On Mon, Feb 12, 2018 at 4:08 AM, Nick Clifton <nickc@redhat.com> wrote:
>   Would you mind updating your recent commits please ?

>

>> +         /* Don't choose trampoline that contains the source.  */

>> +         if (source >= trampoline_frag->fr_address &&

>> +             source <= trampoline_frag->fr_address + trampoline_frag->fr_fix)

>> +           continue;

>

>   The GNU Coding standard requires that boolean conditional

>   operators should be at the start of a line, not the end:

>

> https://www.gnu.org/prep/standards/html_node/Formatting.html#Formatting

>

>   So the above fragment, for example, should be:

>

>             /* Don't choose trampoline that contains the source.  */

>             if (source >= trampoline_frag->fr_address

>                 && source <= trampoline_frag->fr_address + trampoline_frag->fr_fix)

>               continue;


Thanks for the review. Will fix that.

-- 
Thanks.
-- Max

Patch

diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index 58c2e10c1878..1dbb73aa55c7 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -9339,6 +9339,11 @@  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