Patch for bfd/coff-h8300.c

Kazu Hirata kazu@hxi.com
Sun Mar 19 17:13:00 GMT 2000


Hi,

Attached is a patch for bfd/coff-h8300.c against a snapshot on Mar 18.

Here is the summary of the patch. When you have something like the
following sample code, the linker aborts. This is because bfd does not
handle a relaxation from bsr:16->bsr:8 although it does bCC:16->bCC:8. A
usual C code is unlikely to hit this bug since people, including gcc,
usually use jsr (24-bit-address subroutine call). However, a hand-coded
assembly code may encounter it.

/* main.c */
int main(void)
{
  __asm__ __volatile__ ("bsr\t_dummy:16");
  return 0;
}

/* dummy.c */
void dummy(void)
{
}

Kazu Hirata
2000-03-19  Kazu Hirata  <kazu@hxi.com>

	* coff-h8300.c (h8300_reloc16_extra_cases): Add bsr:16 -> bsr:8 to
	the R_PCRWORD_B case.
diff -ruN binutils-000318-old/bfd/coff-h8300.c binutils-000318/bfd/coff-h8300.c
--- binutils-000318-old/bfd/coff-h8300.c	Mon Mar 13 18:57:25 2000
+++ binutils-000318/bfd/coff-h8300.c	Sun Mar 19 20:04:51 2000
@@ -901,6 +901,10 @@
 	  /* Write it.  */
 	  bfd_put_8 (abfd, tmp, data + dst_address - 2);
 	  break;
+	case 0x5c:
+	  /* bsr:16 -> bsr:8 */
+	  bfd_put_8 (abfd, 0x55, data + dst_address - 2);
+	  break;
 
 	default:
 	  abort ();



More information about the Binutils mailing list