This is the mail archive of the binutils@sources.redhat.com 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]

Re: Bug in gas generating sh PIC, or is it me?


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


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