binutils 2.11.2 sh-coff asserts building gcc 3.0-cvs

Nick Clifton nickc@cambridge.redhat.com
Wed Jul 11 04:24:00 GMT 2001


Hi Michael,

> libgcc2.s:14: Error: Cannot represent relocation type BFD_RELOC_32
> libgcc2.s:15: Internal error!
> Assertion failure in tc_gen_reloc at /usr/local/src/gnu/binutils-cvs/src/gas/config/tc-sh.c line 3353.
> Please report this bug.

Hmm, I am not sure what is going on here.  It appears that the coff-sh
target does not support any relocs in its binaries.  This seems rather
strange to me, but I do not know if this is intended or not.

Anyway the patch below will make the error above go away, but I doubt
if it is really the right thing to do.  You can try it if you like.
IF it works, let me know.

Cheers
        Nick

2001-07-11  Nick Clifton  <nickc@cambridge.redhat.com>

	* coff-sh.c (sh_coff_reloc_type_lookup): Provide for sh-coff
	targets as well as sh-pe.

Index: bfd/coff-sh.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-sh.c,v
retrieving revision 1.15
diff -w -p -r1.15 coff-sh.c
*** coff-sh.c	2001/03/08 21:03:57	1.15
--- coff-sh.c	2001/07/11 11:22:58
*************** Foundation, Inc., 59 Temple Place - Suit
*** 24,29 ****
--- 24,30 ----
  #include "bfd.h"
  #include "sysdep.h"
  #include "libbfd.h"
+ #include "libiberty.h"
  #include "bfdlink.h"
  #include "coff/sh.h"
  #include "coff/internal.h"
*************** coff_sh_rtype_to_howto (abfd, sec, rel, 
*** 460,465 ****
--- 461,468 ----
    return howto;
  }
  
+ #endif /* COFF_WITH_PE */
+ 
  /* This structure is used to map BFD reloc codes to SH PE relocs.  */
  struct shcoff_reloc_map
  {
*************** sh_coff_reloc_type_lookup (abfd, code)
*** 486,501 ****
  {
    unsigned int i;
  
!   for (i = 0; i < sizeof (sh_reloc_map) / sizeof (struct shcoff_reloc_map); i++)
!     {
        if (sh_reloc_map[i].bfd_reloc_val == code)
  	return &sh_coff_howtos[(int) sh_reloc_map[i].shcoff_reloc_val];
-     }
  
    fprintf (stderr, "SH Error: unknown reloc type %d\n", code);
    return NULL;
  }
- #endif /* COFF_WITH_PE */
  
  /* This macro is used in coffcode.h to get the howto corresponding to
     an internal reloc.  */
--- 489,501 ----
  {
    unsigned int i;
  
!   for (i = ARRAY_SIZE (sh_reloc_map); i--;)
      if (sh_reloc_map[i].bfd_reloc_val == code)
        return &sh_coff_howtos[(int) sh_reloc_map[i].shcoff_reloc_val];
  
    fprintf (stderr, "SH Error: unknown reloc type %d\n", code);
    return NULL;
  }
  
  /* This macro is used in coffcode.h to get the howto corresponding to
     an internal reloc.  */



More information about the Binutils mailing list