This is the mail archive of the binutils-cvs@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]

[binutils-gdb] xtensa: fix gas trampolines regression


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=dc58915f3af581f32d575acd37e0cfe047c7990b

commit dc58915f3af581f32d575acd37e0cfe047c7990b
Author: Max Filippov <jcmvbkbc@gmail.com>
Date:   Sun May 10 01:02:31 2015 +0300

    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-13  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.

Diff:
---
 gas/ChangeLog                         |  5 +++++
 gas/config/tc-xtensa.c                |  3 +--
 gas/testsuite/ChangeLog               |  4 ++++
 gas/testsuite/gas/xtensa/trampoline.s | 10 ++++++++++
 4 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 4877538..683a30e 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-13  Max Filippov  <jcmvbkbc@gmail.com>
+
+	* config/tc-xtensa.c (xtensa_relax_frag): Allow trampoline to be
+	closer than J_RANGE / 2 to jump frag.
+
 2015-05-11  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* configure.tgt (arch): Set to iamcu for i386-*-elfiamcu target.
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/ChangeLog b/gas/testsuite/ChangeLog
index 793b329..5f3f43d 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2015-05-13  Max Filippov  <jcmvbkbc@gmail.com>
+
+	* gas/xtensa/trampoline.s: Add regression testcase.
+
 2015-05-11  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* gas/i386/i386.exp: Run iamcu-1, iamcu-2, iamcu-3, iamcu-inval-1,
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


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