This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] xtensa: fix gas trampolines regression


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]