From: "Asgari J. Jinia" <AsgariJ@KPITCummins.com>
To: <binutils@sources.redhat.com>
Subject: [PATCH-SH]:Generating proper relocations to link with Renesas SHC linker
Date: Tue, 23 Mar 2004 18:20:00 -0000 [thread overview]
Message-ID: <69595093233BB547BB70CF5E492B63F201D0410A@sohm.kpit.com> (raw)
Hi,
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.
Regards,
Asgari Jinia
KPIT Cummins
Testcase:
Following is simple test code.
Command Line: sh-elf-gcc test.c -c -mhitachi -o test.o
/* test.c */
static int foo( int a, int b, int c)
{
return a+b;
}
static int bar( int a, int b, int c)
{
return a+b;
}
int dummymain()
{
foo(1,2,3);
bar(1,2,3);
}
If test.o is linked with Renesas SHC linker and called "dummymain", "foo" is
called instead of "bar".
Patch:
gas/ChangeLog:
2004-03-23 Asgari Jinia <asgarij@kpitcummins.com>
* config/tc-sh.c (tc_gen_reloc): addend updated with fixp->fx_offset for
BFD_RELOC_32 and BFD_RELOC_32_GOTOFF type relocations.
==========================================================
--- 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;
next reply other threads:[~2004-03-23 12:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-23 18:20 Asgari J. Jinia [this message]
2004-03-23 18:24 ` Kaz Kojima
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=69595093233BB547BB70CF5E492B63F201D0410A@sohm.kpit.com \
--to=asgarij@kpitcummins.com \
--cc=binutils@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).