[PATCH] New targets for H8300H and H8300S Normal mode

Dhananjay R. Deshpande dhananjayd@kpit.com
Wed Apr 23 10:56:00 GMT 2003


Hi,

-----Original Message-----
From: Nick Clifton [mailto:nickc@redhat.com]
Sent: Tuesday, April 22, 2003 5:46 PM
To: Dhananjay R. Deshpande
Subject: Re: [PATCH] New targets for H8300H and H8300S Normal mode

>Excellent - please could you resubmit your patches, but made agaunst
>the very latest CVS sources and, as soon as I get confirmation from
>the FSF, I will check them in.


I am sending updated patch for Binutils ( inlined as well as attached ).

- Dhananjay


include/ChangeLog 
2003-04-23 Dhananjay Deshpande <dhananjayd@kpitcummins.com> 

	* coff/h8300.h (H8300HNMAGIC, H8300SNMAGIC): New.
	(H8300HNBADMAG, H8300SNBADMAG): New.
	* elf/h8.h (E_H8_MACH_H8300HN, E_H8_MACH_H8300SN): New

bfd/ChangeLog 
2003-04-23 Dhananjay Deshpande <dhananjayd@kpitcummins.com> 

	* archures.c (bfd_mach_h8300hn, bfd_mach_h8300sn): Added.
	* bfd-in2.h: Rebuilt.
	* coff-h8300.c (BADMAG): Add check for H8300HNBADMAG & H8300SNBADMAG.
	* coffcode.h (coff_set_arch_mach_hook): Add case for H8300HNMAGIC 
	& H8300SNMAGIC.
	(coff_set_flags): Add case for bfd_mach_h8300hn & bfd_mach_h8300sn.
	* cpu-h8300.c (h8300_scan): Handle h8300hn, h8300sn.
	(h8300sn_info_struct, h8300hn_info_struct): New.
	* elf32-h8300.c (elf32_h8_mach): Handle case for h8300hn & h8300sn
	(elf32_h8_final_write_processing): Likewise.

gas/ChangeLog 
2003-04-23 Dhananjay Deshpande <dhananjayd@kpitcummins.com> 

	* config/tc-h8300.c (Nmode, h8300hnmode, h8300snmode): New.
	(md_pseudo_table): Add h8300hn, h8300sn.
	* config/tc-h8300.h (COFF_MAGIC): Handle h8300hn, h8300sn.
	* doc/c-h8300.texi : Add documentation for new machine directives.

ld/ChangeLog 
2003-04-23 Dhananjay Deshpande <dhananjayd@kpitcummins.com> 
	
	* Makefile.am (ALL_EMULATIONS): Add eh8300hn.o, eh8300sn.o, 
	eh8300hnelf.o, eh8300snelf.o and respective rules.
	* Makefile.in: Regenerate.
	* configure.tgt: Add h8300hn, h8300sn, h8300hnelf, h8300snelf
	* emulparams/h8300hn.sh: New
	* emulparams/h8300sn.sh: New
	* emulparams/h8300hnelf.sh: New	
	* emulparams/h8300snelf.sh: New
	* scripttempl/h8300hn.sc: new
	* scripttempl/h8300sn.sc: new

===========================================================================================
diff -rupN binutils.orig/bfd/archures.c binutils-030423/bfd/archures.c
--- binutils.orig/bfd/archures.c	2003-04-23 14:30:46.000000000 +0530
+++ binutils-030423/bfd/archures.c	2003-04-23 14:32:30.000000000 +0530
@@ -167,6 +167,8 @@ DESCRIPTION
 .#define bfd_mach_h8300   1
 .#define bfd_mach_h8300h  2
 .#define bfd_mach_h8300s  3
+.#define bfd_mach_h8300hn  4
+.#define bfd_mach_h8300sn  5
 .  bfd_arch_pdp11,     {* DEC PDP-11 *}
 .  bfd_arch_powerpc,   {* PowerPC *}
 .#define bfd_mach_ppc		32
diff -rupN binutils.orig/bfd/coffcode.h binutils-030423/bfd/coffcode.h
--- binutils.orig/bfd/coffcode.h	2003-04-23 14:30:46.000000000 +0530
+++ binutils-030423/bfd/coffcode.h	2003-04-23 14:32:30.000000000 +0530
@@ -2094,6 +2094,24 @@ coff_set_arch_mach_hook (abfd, filehdr)
       break;
 #endif
 
+#ifdef H8300HNMAGIC
+    case H8300HNMAGIC:
+      arch = bfd_arch_h8300;
+      machine = bfd_mach_h8300hn;
+      /* !! FIXME this probably isn't the right place for this */
+      abfd->flags |= BFD_IS_RELAXABLE;
+      break;
+#endif
+
+#ifdef H8300SNMAGIC
+    case H8300SNMAGIC:
+      arch = bfd_arch_h8300;
+      machine = bfd_mach_h8300sn;
+      /* !! FIXME this probably isn't the right place for this */
+      abfd->flags |= BFD_IS_RELAXABLE;
+      break;
+#endif
+
 #ifdef SH_ARCH_MAGIC_BIG
     case SH_ARCH_MAGIC_BIG:
     case SH_ARCH_MAGIC_LITTLE:
@@ -2739,6 +2757,12 @@ coff_set_flags (abfd, magicp, flagsp)
 	case bfd_mach_h8300s:
 	  *magicp = H8300SMAGIC;
 	  return TRUE;
+	case bfd_mach_h8300hn:
+	  *magicp = H8300HNMAGIC;
+	  return TRUE;
+	case bfd_mach_h8300sn:
+	  *magicp = H8300SNMAGIC;
+	  return TRUE;
 	}
       break;
 #endif
diff -rupN binutils.orig/bfd/coff-h8300.c binutils-030423/bfd/coff-h8300.c
--- binutils.orig/bfd/coff-h8300.c	2003-04-23 14:30:46.000000000 +0530
+++ binutils-030423/bfd/coff-h8300.c	2003-04-23 14:32:30.000000000 +0530
@@ -281,7 +281,8 @@ static reloc_howto_type howto_table[] = 
 #define SELECT_RELOC(x,howto) \
   { x.r_type = select_reloc (howto); }
 
-#define BADMAG(x) (H8300BADMAG (x) && H8300HBADMAG (x) && H8300SBADMAG (x))
+#define BADMAG(x) (H8300BADMAG (x) && H8300HBADMAG (x) && H8300SBADMAG (x) \
+				   && H8300HNBADMAG(x) && H8300SNBADMAG(x))
 #define H8300 1			/* Customize coffcode.h */
 #define __A_MAGIC_SET__
 
diff -rupN binutils.orig/bfd/cpu-h8300.c binutils-030423/bfd/cpu-h8300.c
--- binutils.orig/bfd/cpu-h8300.c	2003-04-23 14:30:46.000000000 +0530
+++ binutils-030423/bfd/cpu-h8300.c	2003-04-23 14:32:30.000000000 +0530
@@ -69,10 +69,20 @@ h8300_scan (info, string)
 
   if (*string == 'h' || *string == 'H')
     {
+      string++;
+      if (*string == 'n' || *string == 'N')
+        {
+          return (info->mach == bfd_mach_h8300hn);
+        }
       return (info->mach == bfd_mach_h8300h);
     }
   else if (*string == 's' || *string == 'S')
     {
+      string++;
+      if (*string == 'n' || *string == 'N')
+        {
+          return (info->mach == bfd_mach_h8300sn);
+        }
       return (info->mach == bfd_mach_h8300s);
     }
   else
@@ -97,6 +107,39 @@ compatible (in, out)
     return in;
 }
 
+static const bfd_arch_info_type h8300sn_info_struct =
+{
+  32,				/* 32 bits in a word */
+  32,				/* 32 bits in an address */
+  8,				/* 8 bits in a byte */
+  bfd_arch_h8300,
+  bfd_mach_h8300sn,
+  "h8300sn",			/* arch_name  */
+  "h8300sn",			/* printable name */
+  1,
+  FALSE,			/* the default machine */
+  compatible,
+  h8300_scan,
+  0
+};
+
+
+static const bfd_arch_info_type h8300hn_info_struct =
+{
+  32,				/* 32 bits in a word */
+  32,				/* 32 bits in an address */
+  8,				/* 8 bits in a byte */
+  bfd_arch_h8300,
+  bfd_mach_h8300hn,
+  "h8300hn",			/* arch_name  */
+  "h8300hn",			/* printable name */
+  1,
+  FALSE,			/* the default machine */
+  compatible,
+  h8300_scan,
+  &h8300sn_info_struct
+};
+
 static const bfd_arch_info_type h8300s_info_struct =
 {
   32,				/* 32 bits in a word */
@@ -110,7 +153,7 @@ static const bfd_arch_info_type h8300s_i
   FALSE,			/* the default machine */
   compatible,
   h8300_scan,
-  0
+  &h8300hn_info_struct
 };
 
 static const bfd_arch_info_type h8300h_info_struct =
diff -rupN binutils.orig/bfd/elf32-h8300.c binutils-030423/bfd/elf32-h8300.c
--- binutils.orig/bfd/elf32-h8300.c	2003-04-23 14:30:46.000000000 +0530
+++ binutils-030423/bfd/elf32-h8300.c	2003-04-23 14:32:30.000000000 +0530
@@ -573,6 +573,12 @@ elf32_h8_mach (flags)
 
     case E_H8_MACH_H8300S:
       return bfd_mach_h8300s;
+
+    case E_H8_MACH_H8300HN:
+      return bfd_mach_h8300hn;
+
+    case E_H8_MACH_H8300SN:
+      return bfd_mach_h8300sn;
     }
 }
 
@@ -601,6 +607,14 @@ elf32_h8_final_write_processing (abfd, l
     case bfd_mach_h8300s:
       val = E_H8_MACH_H8300S;
       break;
+
+    case bfd_mach_h8300hn:
+      val = E_H8_MACH_H8300HN;
+      break;
+
+    case bfd_mach_h8300sn:
+      val = E_H8_MACH_H8300SN;
+      break;
     }
 
   elf_elfheader (abfd)->e_flags &= ~ (EF_H8_MACH);
diff -rupN binutils.orig/gas/config/tc-h8300.c binutils-030423/gas/config/tc-h8300.c
--- binutils.orig/gas/config/tc-h8300.c	2003-04-23 14:30:48.000000000 +0530
+++ binutils-030423/gas/config/tc-h8300.c	2003-04-23 14:32:30.000000000 +0530
@@ -42,10 +42,13 @@ void cons        PARAMS ((int));
 void sbranch     PARAMS ((int));
 void h8300hmode  PARAMS ((int));
 void h8300smode  PARAMS ((int));
+void h8300hnmode  PARAMS ((int));
+void h8300snmode  PARAMS ((int));
 static void pint PARAMS ((int));
 
 int Hmode;
 int Smode;
+int Nmode;
 
 #define PSIZE (Hmode ? L_32 : L_16)
 #define DMODE (L_16)
@@ -77,6 +80,19 @@ h8300hmode (arg)
 }
 
 void
+h8300hnmode (arg)
+     int arg ATTRIBUTE_UNUSED;
+{
+  Hmode = 1;
+  Smode = 0;
+  Nmode = 1;
+#ifdef BFD_ASSEMBLER
+  if (!bfd_set_arch_mach (stdoutput, bfd_arch_h8300, bfd_mach_h8300hn))
+    as_warn (_("could not set architecture and machine"));
+#endif
+}
+
+void
 h8300smode (arg)
      int arg ATTRIBUTE_UNUSED;
 {
@@ -89,6 +105,19 @@ h8300smode (arg)
 }
 
 void
+h8300snmode (arg)
+     int arg ATTRIBUTE_UNUSED;
+{
+  Smode = 1;
+  Hmode = 1;
+  Nmode = 1;
+#ifdef BFD_ASSEMBLER
+  if (!bfd_set_arch_mach (stdoutput, bfd_arch_h8300, bfd_mach_h8300sn))
+    as_warn (_("could not set architecture and machine"));
+#endif
+}
+
+void
 sbranch (size)
      int size;
 {
@@ -111,7 +140,9 @@ pint (arg)
 const pseudo_typeS md_pseudo_table[] =
 {
   {"h8300h", h8300hmode, 0},
+  {"h8300hn", h8300hnmode, 0},
   {"h8300s", h8300smode, 0},
+  {"h8300sn", h8300snmode, 0},
   {"sbranch", sbranch, L_8},
   {"lbranch", sbranch, L_16},
 
diff -rupN binutils.orig/gas/config/tc-h8300.h binutils-030423/gas/config/tc-h8300.h
--- binutils.orig/gas/config/tc-h8300.h	2003-04-23 14:30:48.000000000 +0530
+++ binutils-030423/gas/config/tc-h8300.h	2003-04-23 14:32:30.000000000 +0530
@@ -45,7 +45,7 @@ struct internal_reloc;
 #define TC_COFF_FIX2RTYPE(fixP) abort ();
 
 #define BFD_ARCH bfd_arch_h8300
-#define COFF_MAGIC ( Smode ? 0x8302 : Hmode ? 0x8301 : 0x8300)
+#define COFF_MAGIC ( Smode && Nmode ? 0x8304 : Hmode && Nmode ? 0x8303 : Smode ? 0x8302 : Hmode ? 0x8301 : 0x8300)
 #define TC_COUNT_RELOC(x) (1)
 #define IGNORE_NONSTANDARD_ESCAPES
 
@@ -92,5 +92,6 @@ extern void tc_reloc_mangle
 
 extern int Hmode;
 extern int Smode;
+extern int Nmode;
 
 #define md_operand(x)
diff -rupN binutils.orig/gas/doc/c-h8300.texi binutils-030423/gas/doc/c-h8300.texi
--- binutils.orig/gas/doc/c-h8300.texi	2003-04-23 14:30:48.000000000 +0530
+++ binutils-030423/gas/doc/c-h8300.texi	2003-04-23 15:03:26.000000000 +0530
@@ -134,7 +134,7 @@ with other development tools.
 @cindex machine directives, H8/300 (none)
 @cindex @code{word} directive, H8/300
 @cindex @code{int} directive, H8/300
-@code{@value{AS}} has only one machine-dependent directive for the
+@code{@value{AS}} has following machine-dependent directives for the
 H8/300:
 
 @table @code
@@ -143,6 +143,18 @@ H8/300:
 Recognize and emit additional instructions for the H8/300H variant, and
 also make @code{.int} emit 32-bit numbers rather than the usual (16-bit)
 for the H8/300 family.
+@item .h8300s
+Recognize and emit additional instructions for the H8S variant, and
+also make @code{.int} emit 32-bit numbers rather than the usual (16-bit)
+for the H8/300 family.
+@item .h8300hn
+Recognize and emit additional instructions for the H8/300H variant in
+normal mode, and also make @code{.int} emit 32-bit numbers rather than 
+the usual (16-bit) for the H8/300 family.
+@item .h8300sn
+Recognize and emit additional instructions for the H8S variant in
+normal mode, and also make @code{.int} emit 32-bit numbers rather than 
+the usual (16-bit) for the H8/300 family.
 @end table
 
 On the H8/300 family (including the H8/300H) @samp{.word} directives
diff -rupN binutils.orig/include/coff/h8300.h binutils-030423/include/coff/h8300.h
--- binutils.orig/include/coff/h8300.h	2003-04-23 14:30:53.000000000 +0530
+++ binutils-030423/include/coff/h8300.h	2003-04-23 14:32:30.000000000 +0530
@@ -22,10 +22,14 @@
 #define	H8300MAGIC	0x8300
 #define	H8300HMAGIC	0x8301
 #define	H8300SMAGIC	0x8302
+#define	H8300HNMAGIC	0x8303
+#define	H8300SNMAGIC	0x8304
 
 #define H8300BADMAG(x)  (((x).f_magic != H8300MAGIC))
 #define H8300HBADMAG(x) (((x).f_magic != H8300HMAGIC))
 #define H8300SBADMAG(x) (((x).f_magic != H8300SMAGIC))
+#define H8300HNBADMAG(x) (((x).f_magic != H8300HNMAGIC))
+#define H8300SNBADMAG(x) (((x).f_magic != H8300SNMAGIC))
 
 /********************** RELOCATION DIRECTIVES **********************/
 
diff -rupN binutils.orig/include/elf/h8.h binutils-030423/include/elf/h8.h
--- binutils.orig/include/elf/h8.h	2003-04-23 14:30:53.000000000 +0530
+++ binutils-030423/include/elf/h8.h	2003-04-23 14:32:30.000000000 +0530
@@ -92,5 +92,7 @@ END_RELOC_NUMBERS (R_H8_max)
 #define E_H8_MACH_H8300		0x00800000
 #define E_H8_MACH_H8300H	0x00810000
 #define E_H8_MACH_H8300S	0x00820000
+#define E_H8_MACH_H8300HN	0x00830000
+#define E_H8_MACH_H8300SN	0x00840000
 
 #endif
diff -rupN binutils.orig/ld/configure.tgt binutils-030423/ld/configure.tgt
--- binutils.orig/ld/configure.tgt	2003-04-23 14:30:55.000000000 +0530
+++ binutils-030423/ld/configure.tgt	2003-04-23 14:32:30.000000000 +0530
@@ -261,11 +261,11 @@ thumb-*-pe)		targ_emul=armpe ;
 xscale-*-coff)		targ_emul=armcoff ;;
 xscale-*-elf)		targ_emul=armelf ;;
 h8300-*-hms* | h8300-*-coff* | h8300-*-rtems*)
-			targ_emul=h8300; targ_extra_emuls="h8300h h8300s"
+			targ_emul=h8300; targ_extra_emuls="h8300h h8300s h8300hn h8300sn"
 			;;
 h8300-*-elf*)
 			targ_emul=h8300elf;
-			targ_extra_emuls="h8300helf h8300self"
+			targ_extra_emuls="h8300helf h8300self h8300hnelf h8300snelf"
 			;;
 h8500-*-hms* | h8500-*-coff* | h8500-*-rtems*)
 			targ_emul=h8500
diff -rupN binutils.orig/ld/emulparams/h8300hnelf.sh binutils-030423/ld/emulparams/h8300hnelf.sh
--- binutils.orig/ld/emulparams/h8300hnelf.sh	1970-01-01 05:30:00.000000000 +0530
+++ binutils-030423/ld/emulparams/h8300hnelf.sh	2003-04-23 14:35:51.000000000 +0530
@@ -0,0 +1,2 @@
+. ${srcdir}/emulparams/h8300elf.sh
+ARCH="h8300:h8300hn"
diff -rupN binutils.orig/ld/emulparams/h8300hn.sh binutils-030423/ld/emulparams/h8300hn.sh
--- binutils.orig/ld/emulparams/h8300hn.sh	1970-01-01 05:30:00.000000000 +0530
+++ binutils-030423/ld/emulparams/h8300hn.sh	2003-04-23 14:35:51.000000000 +0530
@@ -0,0 +1,5 @@
+SCRIPT_NAME=h8300hn
+OUTPUT_FORMAT="coff-h8300"
+TEXT_START_ADDR=0x8000
+TARGET_PAGE_SIZE=128
+ARCH=h8300
diff -rupN binutils.orig/ld/emulparams/h8300snelf.sh binutils-030423/ld/emulparams/h8300snelf.sh
--- binutils.orig/ld/emulparams/h8300snelf.sh	1970-01-01 05:30:00.000000000 +0530
+++ binutils-030423/ld/emulparams/h8300snelf.sh	2003-04-23 14:35:51.000000000 +0530
@@ -0,0 +1,2 @@
+. ${srcdir}/emulparams/h8300elf.sh
+ARCH="h8300:h8300sn"
diff -rupN binutils.orig/ld/emulparams/h8300sn.sh binutils-030423/ld/emulparams/h8300sn.sh
--- binutils.orig/ld/emulparams/h8300sn.sh	1970-01-01 05:30:00.000000000 +0530
+++ binutils-030423/ld/emulparams/h8300sn.sh	2003-04-23 14:35:51.000000000 +0530
@@ -0,0 +1,5 @@
+SCRIPT_NAME=h8300sn
+OUTPUT_FORMAT="coff-h8300"
+TEXT_START_ADDR=0x8000
+TARGET_PAGE_SIZE=128
+ARCH=h8300
diff -rupN binutils.orig/ld/Makefile.am binutils-030423/ld/Makefile.am
--- binutils.orig/ld/Makefile.am	2003-04-23 14:30:55.000000000 +0530
+++ binutils-030423/ld/Makefile.am	2003-04-23 14:32:30.000000000 +0530
@@ -195,9 +195,13 @@ ALL_EMULATIONS = \
 	eh8300.o \
 	eh8300h.o \
 	eh8300s.o \
+	eh8300hn.o \
+	eh8300sn.o \
 	eh8300elf.o \
 	eh8300helf.o \
 	eh8300self.o \
+	eh8300hnelf.o \
+	eh8300snelf.o \
 	eh8500.o \
 	eh8500b.o \
 	eh8500c.o \
@@ -821,6 +825,12 @@ eh8300h.c: $(srcdir)/emulparams/h8300h.s
 eh8300s.c: $(srcdir)/emulparams/h8300s.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300s.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} h8300s "$(tdir_h8300s)"
+eh8300hn.c: $(srcdir)/emulparams/h8300hn.sh \
+  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300hn.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} h8300hn "$(tdir_h8300hn)"
+eh8300sn.c: $(srcdir)/emulparams/h8300sn.sh \
+  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300sn.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} h8300sn "$(tdir_h8300sn)"
 eh8300elf.c: $(srcdir)/emulparams/h8300elf.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} h8300elf "$(tdir_h8300elf)"
@@ -832,6 +842,14 @@ eh8300self.c: $(srcdir)/emulparams/h8300
   $(srcdir)/emulparams/h8300elf.sh \
   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} h8300self "$(tdir_h8300self)"
+eh8300hnelf.c: $(srcdir)/emulparams/h8300hnelf.sh \
+  $(srcdir)/emulparams/h8300elf.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} h8300hnelf "$(tdir_h8300hnelf)"
+eh8300snelf.c: $(srcdir)/emulparams/h8300snelf.sh \
+  $(srcdir)/emulparams/h8300elf.sh \
+  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+	${GENSCRIPTS} h8300snelf "$(tdir_h8300snelf)"
 eh8500.c: $(srcdir)/emulparams/h8500.sh \
   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500.sc ${GEN_DEPENDS}
 	${GENSCRIPTS} h8500 "$(tdir_h8500)"
diff -rupN binutils.orig/ld/scripttempl/h8300hn.sc binutils-030423/ld/scripttempl/h8300hn.sc
--- binutils.orig/ld/scripttempl/h8300hn.sc	1970-01-01 05:30:00.000000000 +0530
+++ binutils-030423/ld/scripttempl/h8300hn.sc	2003-04-23 14:35:51.000000000 +0530
@@ -0,0 +1,87 @@
+TORS=".tors :
+	{
+	  ___ctors = . ;
+	  *(.ctors)
+	  ___ctors_end = . ;
+	  ___dtors = . ;
+	  *(.dtors)
+	  ___dtors_end = . ;
+	} > ram"
+
+cat <<EOF
+OUTPUT_FORMAT("${OUTPUT_FORMAT}")
+OUTPUT_ARCH(h8300hn)
+ENTRY("_start")
+
+MEMORY
+{
+	/* 0xc4 is a magic entry.  We should have the linker just
+	   skip over it one day...  */
+	vectors : o = 0x0000, l = 0xc4
+	magicvectors : o = 0xc4, l = 0x3c
+	ram    : o = 0x0100, l = 0xfdfc
+	/* The stack starts at the top of main ram.  */
+	topram : o = 0xfefc, l = 0x4
+	/* At the very top of the address space is the 8-bit area.  */
+	eight : o = 0xff00, l = 0x100
+}
+
+SECTIONS
+{
+.vectors :
+	{
+	  /* Use something like this to place a specific
+	     function's address into the vector table.
+
+	     SHORT (ABSOLUTE (_foobar)).  */
+
+	  *(.vectors)
+	} ${RELOCATING+ > vectors}
+
+.text :
+	{
+	  *(.rodata)
+	  *(.text)
+	  *(.strings)
+   	  ${RELOCATING+ _etext = . ; }
+	} ${RELOCATING+ > ram}
+
+${CONSTRUCTING+${TORS}}
+
+.data :
+	{
+	  *(.data)
+	  *(.tiny)
+	  ${RELOCATING+ _edata = . ; }
+	} ${RELOCATING+ > ram}
+
+.bss :
+	{
+	  ${RELOCATING+ _bss_start = . ;}
+	  *(.bss)
+	  *(COMMON)
+	  ${RELOCATING+ _end = . ;  }
+	} ${RELOCATING+ >ram}
+
+.stack :
+	{
+	  ${RELOCATING+ _stack = . ; }
+	  *(.stack)
+	} ${RELOCATING+ > topram}
+
+.eight :
+	{
+	  *(.eight)
+	} ${RELOCATING+ > eight}
+
+.stab 0 ${RELOCATING+(NOLOAD)} :
+	{
+	  [ .stab ]
+	}
+
+.stabstr 0 ${RELOCATING+(NOLOAD)} :
+	{
+	  [ .stabstr ]
+	}
+}
+EOF
diff -rupN binutils.orig/ld/scripttempl/h8300sn.sc binutils-030423/ld/scripttempl/h8300sn.sc
--- binutils.orig/ld/scripttempl/h8300sn.sc	1970-01-01 05:30:00.000000000 +0530
+++ binutils-030423/ld/scripttempl/h8300sn.sc	2003-04-23 14:35:51.000000000 +0530
@@ -0,0 +1,87 @@
+TORS=".tors :
+	{
+	  ___ctors = . ;
+	  *(.ctors)
+	  ___ctors_end = . ;
+	  ___dtors = . ;
+	  *(.dtors)
+	  ___dtors_end = . ;
+	} > ram"
+
+cat <<EOF
+OUTPUT_FORMAT("${OUTPUT_FORMAT}")
+OUTPUT_ARCH(h8300sn)
+ENTRY("_start")
+
+MEMORY
+{
+	/* 0xc4 is a magic entry.  We should have the linker just
+	   skip over it one day...  */
+	vectors : o = 0x0000, l = 0xc4
+	magicvectors : o = 0xc4, l = 0x3c
+	ram    : o = 0x0100, l = 0xfdfc
+	/* The stack starts at the top of main ram.  */
+	topram : o = 0xfefc, l = 0x4
+	/* At the very top of the address space is the 8-bit area.  */
+	eight : o = 0xff00, l = 0x100
+}
+
+SECTIONS
+{
+.vectors :
+	{
+	  /* Use something like this to place a specific
+	     function's address into the vector table.
+
+	     SHORT (ABSOLUTE (_foobar)).  */
+
+	  *(.vectors)
+	} ${RELOCATING+ > vectors}
+
+.text :
+	{
+	  *(.rodata)
+	  *(.text)
+	  *(.strings)
+   	  ${RELOCATING+ _etext = . ; }
+	} ${RELOCATING+ > ram}
+
+${CONSTRUCTING+${TORS}}
+
+.data :
+	{
+	  *(.data)
+	  *(.tiny)
+	  ${RELOCATING+ _edata = . ; }
+	} ${RELOCATING+ > ram}
+
+.bss :
+	{
+	  ${RELOCATING+ _bss_start = . ;}
+	  *(.bss)
+	  *(COMMON)
+	  ${RELOCATING+ _end = . ;  }
+	} ${RELOCATING+ >ram}
+
+.stack :
+	{
+	  ${RELOCATING+ _stack = . ; }
+	  *(.stack)
+	} ${RELOCATING+ > topram}
+
+.eight :
+	{
+	  *(.eight)
+	} ${RELOCATING+ > eight}
+
+.stab 0 ${RELOCATING+(NOLOAD)} :
+	{
+	  [ .stab ]
+	}
+
+.stabstr 0 ${RELOCATING+(NOLOAD)} :
+	{
+	  [ .stabstr ]
+	}
+}
+EOF
===========================================================================================
-------------- next part --------------
A non-text attachment was scrubbed...
Name: normal.binutils.diff
Type: application/octet-stream
Size: 17635 bytes
Desc: normal.binutils.diff
URL: <https://sourceware.org/pipermail/binutils/attachments/20030423/43479412/attachment.obj>


More information about the Binutils mailing list