bad sh linking error with test case

Ralf Corsepius corsepiu@faw.uni-ulm.de
Thu Apr 4 15:20:00 GMT 2002


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?

With this patch applied, "fred" correctly reports an error and RTEMS
also seems to build correctly.

Ralf


-------------- next part --------------
Index: bfd/coff-sh.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-sh.c,v
retrieving revision 1.20
diff -u -r1.20 coff-sh.c
--- coff-sh.c	2002/03/07 18:11:20	1.20
+++ coff-sh.c	2002/04/04 22:45:04
@@ -476,9 +476,15 @@
 /* An array mapping BFD reloc codes to SH PE relocs.  */
 static const struct shcoff_reloc_map sh_reloc_map[] =
 {
+#if COFF_WITH_PE
   { BFD_RELOC_32, R_SH_IMM32CE },
   { BFD_RELOC_RVA, R_SH_IMAGEBASE },
   { BFD_RELOC_CTOR, R_SH_IMM32CE },
+#else
+  { BFD_RELOC_32, R_SH_IMM32 },
+  { BFD_RELOC_RVA, R_SH_IMAGEBASE },
+  { BFD_RELOC_CTOR, R_SH_IMM32 },
+#endif
 };
 
 /* Given a BFD reloc code, return the howto structure for the


More information about the Binutils mailing list