This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [PATCH-SH]:Generating proper relocations to link with RenesasSHC linker
- From: Kaz Kojima <kkojima at rr dot iij4u dot or dot jp>
- To: binutils at sources dot redhat dot com
- Date: Wed, 24 Mar 2004 00:26:05 +0900 (JST)
- Subject: Re: [PATCH-SH]:Generating proper relocations to link with RenesasSHC linker
- References: <69595093233BB547BB70CF5E492B63F201D0410A@sohm.kpit.com>
"Asgari J. Jinia" <AsgariJ@KPITCummins.com> wrote:
> If GNU object file for SH target which contains static functions is linked
> with other Renesas SHC objects by SHC linker, it does not call GNU
> functions properly. It always calls the first static function when other
> static functions are called. This is because GNU assembler does not emit
> relocations with addend values in case of static functions.
>
> Following patch emits addend value in relocations for static declarations so
> that it will correctly link with Renesas linker.
[snip]
> --- gas/config/tc-sh.c.old Wed Dec 31 17:05:28 2003
> +++ gas/config/tc-sh.c Tue Mar 23 17:26:03 2004
> @@ -3957,7 +3957,7 @@ tc_gen_reloc (section, fixp)
> else if (fixp->fx_pcrel)
> rel->addend = fixp->fx_addnumber;
> else if (r_type == BFD_RELOC_32 || r_type == BFD_RELOC_32_GOTOFF)
> - rel->addend = fixp->fx_addnumber;
> + rel->addend = fixp->fx_offset;
> else
> rel->addend = 0;
With your patch, I've got many failures of ld testsuite for
sh-unknown-linux-gnu and one failure about partial linking
for sh-elf on mainline. It seems that gas with your patch
sets both in-place relocation and addend for R_SH_DIR32.
It would be a radical change of ABI and anyway, your patch
doesn't work together with the current GNU linker.
Regards,
kaz