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: "Asgari J. Jinia" <AsgariJ at KPITCummins dot com>
- To: <binutils at sources dot redhat dot com>
- Date: Thu, 25 Mar 2004 19:59:16 +0530
- Subject: Re: [PATCH-SH]:Generating proper relocations to link with RenesasSHC linker
Hi,
Actually my requirement is that I have a library which I have to compile
using GNUSH assembler and the generated object file is to be linked
with Renesas linker for SH. In my library I have number of static
functions and when I link them using Renesas linker, they are not
getting relocated properly. In relocation table of my library object,
all static functions have .text as relocation offset so Renesas linker
relocates all static functions at .text. But when I add addend to
relocation offset (e.g. .text+0x00000e) they get correctly relocated
by Renesas linker.
My earlier patch was for this specific purpose which is Renesas specific.
Can this patch be added for -mhitachi or -mrenesas switch so that it can
be accepted by FSF? or Can you please suggest any other way to achieve this?
Please refer following test code.
static int foo( int a, int b, int c)
{
int i = 20;
return a+b;
}
static int bar( int a, int b, int c)
{
return a+b;
}
int try( int a, int b, int c)
{
return a+b;
}
int dummymain()
{
foo(1,2,3);
bar(1,2,3);
try(1,2,3);
}
If this code is compiled using GNUSH, resulting .o file's relocation table
is as folows.
Command line : sh-elf-gcc -c -mhitachi test.c
RELOCATION RECORDS FOR [.text]:
OFFSET TYPE VALUE
00000094 R_SH_DIR32 .text
00000098 R_SH_DIR32 .text
0000009c R_SH_DIR32 _try
Regards,
Asgari
>
> But .o object with R_SH_DIR32 having no in-place relocation is
> not GNU object. If the Renesas linker really needs such objects,
> Renesas assembler should do so. Why don't you use it?
>
> BTW, does Renesas assembler really do it so? AFAIK, the current
> behavior of gas for R_SH_DIR32 is fairly old and I've seen no
> complaint about it. It would be better to try to assemble a simple
> assembler program like
>
> .text
> .long bar
> bar:
>
> with your Renesas assembler and see the relocation by objdump -Dr
> to confirm it.
>
> Regards,
> kaz
>
>