Bug 10373 - SH: ld relaxes jmp to bsr.
Summary: SH: ld relaxes jmp to bsr.
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-07 07:41 UTC by Takashi YOSHII
Modified: 2014-08-02 15:21 UTC (History)
3 users (show)

See Also:
Host:
Target: sh-*-*
Build:
Last reconfirmed:


Attachments
test program (75 bytes, text/plain)
2009-07-07 07:44 UTC, Takashi YOSHII
Details
patch to fix (853 bytes, patch)
2009-07-07 08:03 UTC, Takashi YOSHII
Details | Diff
testcase patch for ld (846 bytes, patch)
2009-07-07 08:25 UTC, Takashi YOSHII
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Takashi YOSHII 2009-07-07 07:41:06 UTC
ld relaxes jmp to bsr which should be bra. Apparently, it doesn't care about
jmp, but just generate bsr for R_SH_USES.
Comment 1 Takashi YOSHII 2009-07-07 07:44:58 UTC
Created attachment 4039 [details]
test program

as -relax jmp.s -o jmp.o; ld -relax jmp.o; objdump -d a.out
You will found "bsr" where "bra" should be.
Comment 2 Takashi YOSHII 2009-07-07 08:03:01 UTC
Created attachment 4040 [details]
patch to fix

Because gcc generates .uses(R_SH_USES) both for jmp and jsr,
1. Gcc should not generate .uses for jmp. or
2. Ld should process both jmp and jsr.
I believe 2 is better.
This patch adds "jmp to bra" process to bfd.
Comment 3 Takashi YOSHII 2009-07-07 08:25:10 UTC
Created attachment 4041 [details]
testcase patch for ld

This patch adds test for "jmp to bra relaxing" to ld's testcase.
Comment 4 Oleg Endo 2014-06-20 22:46:47 UTC
I believe this is a (partial) dup of PR 3298.
Comment 5 Oleg Endo 2014-08-02 15:21:24 UTC
The issue has been fixed on trunk and should be available in the next release that follows binutils 2.24.