This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Bug in gas generating sh PIC, or is it me?
- From: kaz Kojima <kkojima at rr dot iij4u dot or dot jp>
- To: gp at qnx dot com
- Cc: dank at kegel dot com, binutils at sources dot redhat dot com
- Date: Sat, 30 Nov 2002 20:12:24 +0900
- Subject: Re: Bug in gas generating sh PIC, or is it me?
- References: <200211300623.BAA26344@hub.ott.qnx.com>
Hi,
<gp@qnx.com> wrote:
>I'm pretty sure that I tried this with the head branch from the GNU cvs, and
>observed the same thing - the value that gets put in the .o (and then
>the .so) for the jump into the .plt is 2 too big. I'm just hoping for some
>pointers on how to fix it, and confirmation/correction on whether it is a
>binutils bug, so that the fix can get rolled in if appropriate.
I've looked this closely. Yes, it's a bug of SH gas. The PIC expression
bar@PLT+.-2-.L4
isn't assembled correctly as you pointed out. This is related with a
backward-compatibility about how gcc generates such expressions.
Current gcc uses an expression like
f@PLT - (.LPCS# + 2 - .)
and old gcc used a complex expression like
f@PLT + . - (.LPCS# + 2)
and gas transforms the latter to the former internally.
Unfortunately, it handles bar@PLT+.-2-.L4 wrongly without making it an
error. I've fixed it in my local tree and will come up with a patch
and an appropriate testcase. Thank you for your report.
BTW, gcc-2.95.3 would be a very bad choice for SH. I believe that it's
too old and has too many other serious problems on this target.
Perhaps it's a reason of why this bug was missed :-)
Regards,
kaz