public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Max Filippov <jcmvbkbc@gmail.com>
To: binutils@sourceware.org
Cc: Sterling Augustine <augustine.sterling@gmail.com>,
	David Weatherford <weath@cadence.com>,
	Marc Gauthier <marc@cadence.com>,
	linux-xtensa@linux-xtensa.org,	Max Filippov <jcmvbkbc@gmail.com>
Subject: [PATCH] xtensa: fix gas trampolines regression
Date: Sat, 09 May 2015 23:53:00 -0000	[thread overview]
Message-ID: <1431215617-29170-1-git-send-email-jcmvbkbc@gmail.com> (raw)

Extra condition 'abs (addr - trampaddr) < J_RANGE / 2' for trampoline
selection results in regressions: when relaxable jump is little longer
than J_RANGE so that single trampoline makes two new jumps, one longer
than J_RANGE / 2 and one shorter, correct trampoline cannot be found.

Drop that condition.

2015-05-10  Max Filippov  <jcmvbkbc@gmail.com>
gas/
	* config/tc-xtensa.c (xtensa_relax_frag): Allow trampoline to be
	closer than J_RANGE / 2 to jump frag.

gas/testsuite/
	* gas/xtensa/trampoline.s: Add regression testcase.
---
 gas/config/tc-xtensa.c                |  3 +--
 gas/testsuite/gas/xtensa/trampoline.s | 10 ++++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index b1827fa..31c0b6b 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -9071,8 +9071,7 @@ xtensa_relax_frag (fragS *fragP, long stretch, int *stretched_p)
 
 	      trampaddr = fragP->fr_address + fragP->fr_fix;
 
-	      if ((addr + J_RANGE < trampaddr) ||
-		  abs (addr - trampaddr) < J_RANGE / 2)
+	      if (addr + J_RANGE < trampaddr)
 		continue;
 	      if (addr > trampaddr + J_RANGE)
 		break;
diff --git a/gas/testsuite/gas/xtensa/trampoline.s b/gas/testsuite/gas/xtensa/trampoline.s
index 4465786..3cfbe97 100644
--- a/gas/testsuite/gas/xtensa/trampoline.s
+++ b/gas/testsuite/gas/xtensa/trampoline.s
@@ -26,3 +26,13 @@
 	.endr
 4:
 	j	4b
+
+5:
+	j	6f
+
+	.rep	43691
+	_nop
+	.endr
+
+6:
+	j	5b
-- 
1.8.1.4

             reply	other threads:[~2015-05-09 23:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-09 23:53 Max Filippov [this message]
2015-05-13 15:27 ` Nicholas Clifton
2015-05-13 16:28   ` Max Filippov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1431215617-29170-1-git-send-email-jcmvbkbc@gmail.com \
    --to=jcmvbkbc@gmail.com \
    --cc=augustine.sterling@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=linux-xtensa@linux-xtensa.org \
    --cc=marc@cadence.com \
    --cc=weath@cadence.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).