This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: bad sh linking error with test case
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Ralf Corsepius <corsepiu at faw dot uni-ulm dot de>,Joel Sherrill <joel dot sherrill at OARcorp dot com>,binutils at sources dot redhat dot com
- Date: Sat, 11 May 2002 13:15:35 -0400
- Subject: Re: bad sh linking error with test case
- References: <3CA9BF84.86C0C73E@OARcorp.com> <20020404072737.GW1042@bubble.sa.bigpond.net.au> <1017962542.22048.30545.camel@mccallum> <20020405003819.GE1042@bubble.sa.bigpond.net.au>
On Fri, Apr 05, 2002 at 10:08:19AM +0930, Alan Modra wrote:
> On Fri, Apr 05, 2002 at 01:22:30AM +0200, Ralf Corsepius wrote:
> > Am Don, 2002-04-04 um 09.27 schrieb Alan Modra:
> > > On Tue, Apr 02, 2002 at 08:26:12AM -0600, Joel Sherrill wrote:
> > > >
> > > > for 2.12. sh-rtems-ld is failing to fail when linking an
> > > > executable that has undefined symbols. As I reported earlier,
> > >
> > > coff-sh.c:sh_coff_reloc_type_lookup is converting BFD_RELOC_32
> > > to R_SH_IMM32CE. coff-sh.c:sh_relocate_section isn't prepared
> > > to deal with this reloc type unless COFF_WITH_PE is defined.
> > >
> > > I'd say sh_coff_reloc_type_lookup needs another table for
> > > non COFF_WITH_PE.
> > Is the patch below what you had in mind?
>
> Yes, something like that, but I see R_SH_IMAGEBASE is a PE only
> reloc too. Don't ask me what the RVA reloc should map to, I
> don't know COFF very well at all.
It shouldn't; it's a PE-specific relocation. It will never be
generated if COFF_WITH_PE isn't defined. I'm committing the logical
extension of this patch to trunk and branch.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
2002-05-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
Daniel Jacobowitz <drow@mvista.com>
* coff-sh.c (sh_reloc_map): Map to R_SH_IMM32 for non-PE. Don't
map BFD_RELOC_RVA.
Index: coff-sh.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-sh.c,v
retrieving revision 1.19.2.1
diff -u -p -r1.19.2.1 coff-sh.c
--- coff-sh.c 28 Mar 2002 06:20:02 -0000 1.19.2.1
+++ coff-sh.c 11 May 2002 17:10:03 -0000
@@ -473,6 +473,7 @@ struct shcoff_reloc_map
unsigned char shcoff_reloc_val;
};
+#ifdef COFF_WITH_PE
/* An array mapping BFD reloc codes to SH PE relocs. */
static const struct shcoff_reloc_map sh_reloc_map[] =
{
@@ -480,6 +481,14 @@ static const struct shcoff_reloc_map sh_
{ BFD_RELOC_RVA, R_SH_IMAGEBASE },
{ BFD_RELOC_CTOR, R_SH_IMM32CE },
};
+#else
+/* An array mapping BFD reloc codes to SH PE relocs. */
+static const struct shcoff_reloc_map sh_reloc_map[] =
+{
+ { BFD_RELOC_32, R_SH_IMM32 },
+ { BFD_RELOC_CTOR, R_SH_IMM32 },
+};
+#endif
/* Given a BFD reloc code, return the howto structure for the
corresponding SH PE reloc. */