From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22835 invoked by alias); 1 Aug 2014 07:13:03 -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 22808 invoked by uid 89); 1 Aug 2014 07:13:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mailout01.t-online.de Received: from mailout01.t-online.de (HELO mailout01.t-online.de) (194.25.134.80) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 01 Aug 2014 07:12:56 +0000 Received: from fwd30.aul.t-online.de (fwd30.aul.t-online.de [172.20.26.135]) by mailout01.t-online.de (Postfix) with SMTP id 72A9D5E6BDB for ; Fri, 1 Aug 2014 09:12:52 +0200 (CEST) Received: from [192.168.0.103] (b7SlZ4Zdrh3yRNIVvm5sN996HjRykOxZbdV6s13uMRUmf2vbmJtpMaP4iT9XJIvwEg@[93.195.18.111]) by fwd30.t-online.de with (TLSv1:ECDHE-RSA-AES256-SHA encrypted) esmtp id 1XD71F-0KywNc0; Fri, 1 Aug 2014 09:12:49 +0200 Message-ID: <1406877169.820.16.camel@yam-132-YW-E178-FTW> Subject: [PATCH] [SH] Fix PR 10378 From: Oleg Endo To: binutils@sourceware.org Date: Fri, 01 Aug 2014 07:13:00 -0000 Content-Type: multipart/mixed; boundary="=-qSP25fFFuwpw5g66qUcK" Mime-Version: 1.0 X-IsSubscribed: yes X-SW-Source: 2014-08/txt/msg00000.txt.bz2 --=-qSP25fFFuwpw5g66qUcK Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Content-length: 325 Hello, The branch relaxation stuff on SH has been broken for a while. A while ago PRs and patches have been submitted but never applied, it seems. Attached is the patch by Takashi Yoshii that fixes PR 10378. Tested with 'make' for target sh-elf. make check RUNTESTFLAGS="--target_board=sh-sim" looks OK, too. Cheers, Oleg --=-qSP25fFFuwpw5g66qUcK Content-Disposition: attachment; filename="0001-Fix-PR-10378.patch" Content-Type: text/x-patch; name="0001-Fix-PR-10378.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit Content-length: 3237 >From 7f632ae6db8bfa2dd764048d068364d6a97fe89e Mon Sep 17 00:00:00 2001 Message-Id: <7f632ae6db8bfa2dd764048d068364d6a97fe89e.1406876013.git.olegendo@gcc.gnu.org> From: Oleg Endo Date: Fri, 1 Aug 2014 08:52:41 +0200 Subject: [PATCH] Fix PR 10378. --- gas/ChangeLog | 6 ++++++ gas/config/tc-sh.c | 2 +- ld/testsuite/ChangeLog | 6 ++++++ ld/testsuite/ld-sh/adjsw8.s | 16 ++++++++++++++++ ld/testsuite/ld-sh/sh.exp | 20 ++++++++++++++++++++ 5 files changed, 49 insertions(+), 1 deletion(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 72d54db..b7926f4 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2014-08-01 Takashi Yoshii + + PR 10378 + * config/tc-sh.c (tc_gen_reloc): Fix initialization of addend in + SWITCH_TABLE case. + 2014-07-29 Matthew Fortune * config/tc-mips.c: Rename INSN_LOAD_COPROC_DELAY to INSN_LOAD_COPROC diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c index a0cd212..6e9ae92 100644 --- a/gas/config/tc-sh.c +++ b/gas/config/tc-sh.c @@ -4435,7 +4435,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp) if (SWITCH_TABLE (fixp)) { *rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_subsy); - rel->addend = 0; + rel->addend = rel->address - S_GET_VALUE(fixp->fx_subsy); if (r_type == BFD_RELOC_16) r_type = BFD_RELOC_SH_SWITCH16; else if (r_type == BFD_RELOC_8) diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 02f9dc4..773a638 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2014-08-01 Takashi Yoshii + + PR 10378 + * ld-sh/adjsw8.s: New. + * ld-sh/sh.exp: Add switch8 adjustment test. + 2014-07-29 Matthew Fortune * ld-mips-elf/abiflags-strip1-ph.d: New. diff --git a/ld/testsuite/ld-sh/adjsw8.s b/ld/testsuite/ld-sh/adjsw8.s new file mode 100644 index 0000000..6518e26 --- /dev/null +++ b/ld/testsuite/ld-sh/adjsw8.s @@ -0,0 +1,16 @@ +L0: .byte L1-L0 + .byte L2-L0 + .byte L3-L0 + .align 1 +L1: mov.l 1f,r1 + .uses L1 + jmp @r1 + nop +L2: mov.l 1f,r1 + .uses L2 + jmp @r1 + nop +L3: nop + .align 2 +1: .long 2f +2: diff --git a/ld/testsuite/ld-sh/sh.exp b/ld/testsuite/ld-sh/sh.exp index 31181a9..a270400 100644 --- a/ld/testsuite/ld-sh/sh.exp +++ b/ld/testsuite/ld-sh/sh.exp @@ -110,6 +110,26 @@ if ![ld_simple_link $ld tmpdir/sh1.s1 $srec_relax_arg ] { } } +set testadjsw8 "SH switch8 adjustment after relax" +if ![ld_assemble $as "-relax $srcdir/$subdir/adjsw8.s" tmpdir/adjsw8.o] { + unresolved $testadjsw8 +} else { + if ![ld_simple_link $ld tmpdir/adjsw8 "-relax tmpdir/adjsw8.o"] { + fail $testadjsw8 + } else { + send_log "exec $objdump -s tmpdir/adjsw8\n" + verbose "exec $objdump -s tmpdir/adjsw8" + catch "exec $objdump -s tmpdir/adjsw8" exec_output + if [string match "*04080c00*" $exec_output] { + pass $testadjsw8 + } else { + send_log "bad switch table\n" + verbose "bad switch table" + fail $testadjsw8 + } + } +} + set testlink "SH relaxing" set testjsr "SH confirm relaxing" set testrun "SH relaxing execution" -- 1.7.9.5 --=-qSP25fFFuwpw5g66qUcK--