From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 115802 invoked by alias); 9 May 2015 23:53:58 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 115793 invoked by uid 89); 9 May 2015 23:53:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,FROM_LOCAL_NOVOWEL,HK_RANDOM_ENVFROM,HK_RANDOM_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-lb0-f173.google.com Received: from mail-lb0-f173.google.com (HELO mail-lb0-f173.google.com) (209.85.217.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sat, 09 May 2015 23:53:56 +0000 Received: by lbbuc2 with SMTP id uc2so73537683lbb.2 for ; Sat, 09 May 2015 16:53:53 -0700 (PDT) X-Received: by 10.152.203.162 with SMTP id kr2mr3229173lac.68.1431215633348; Sat, 09 May 2015 16:53:53 -0700 (PDT) Received: from octofox.metropolis ([5.19.183.212]) by mx.google.com with ESMTPSA id p7sm2057082lae.47.2015.05.09.16.53.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 May 2015 16:53:52 -0700 (PDT) From: Max Filippov To: binutils@sourceware.org Cc: Sterling Augustine , David Weatherford , Marc Gauthier , linux-xtensa@linux-xtensa.org, Max Filippov Subject: [PATCH] xtensa: fix gas trampolines regression Date: Sat, 09 May 2015 23:53:00 -0000 Message-Id: <1431215617-29170-1-git-send-email-jcmvbkbc@gmail.com> X-IsSubscribed: yes X-SW-Source: 2015-05/txt/msg00053.txt.bz2 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 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