Subject: pkgsrc/cross/binutils: additional architectures
To: None <tv@netbsd.org, port-sh3@netbsd.org>
From: Jun-ichiro itojun Hagino <itojun@iijlab.net>
List: port-sh3
Date: 01/03/2001 22:05:34
	i'm trying to add sh3 cross build to pkgsrc/cross/binutils.
	i think i'm almost done, however, i'm not sure about two aspects:
	- we can put certain number of items into ENABLE_TARGETS, due to
	  /bin/sh restriction in ld/config.status.  so i could not add
	  sh{,el}-netbsdelf this time.
	- i'm not sure if other architectures are still happy.

	does the patch sounds good enough?

itojun


---
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/cross/binutils/Makefile,v
retrieving revision 1.19
diff -u -r1.19 Makefile
--- Makefile	2000/08/14 14:57:52	1.19
+++ Makefile	2001/01/03 12:49:58
@@ -26,17 +26,24 @@
 
 BINDIR=			${PREFIX}/libexec/binutils
 
+# due to /bin/sh restriction, we can accomodate no more archs
 ENABLE_TARGETS+=	alpha-netbsd arm-netbsd \
 			i386-cygwin32 i386-elf i386-go32 i386-linux \
 			i386-netbsd i386-netware \
 			m68k-elf m68k-netbsd m68k-sunos4 \
 			mipseb-netbsd mipsel-netbsd \
 			powerpc-eabi powerpcle-eabi \
-			sparc-netbsd sparc-solaris2 sparc-sunos4
+			sparc-netbsd sparc-solaris2 sparc-sunos4 \
+			sh-netbsdcoff shel-netbsdcoff
 
 # this breaks the `sparc-solaris2' target (which adds sparc_elf32
 # which we use for the `sparc-netbsdelf' target
 #ENABLE_TARGETS+=	sparc64-elf
+
+# make sure configure/Makefile.in is newer than configure.in/Makefile.am
+post-patch:
+	${FIND} ${WRKSRC} -name configure -print | xargs ${TOUCH}
+	${FIND} ${WRKSRC} -name Makefile.in -print | xargs ${TOUCH}
 
 # we use MKDIR, not INSTALL_PROGRAM_DIR, deliberately.
 do-install:
Index: files/patch-sum
===================================================================
RCS file: /cvsroot/pkgsrc/cross/binutils/files/patch-sum,v
retrieving revision 1.2
diff -u -r1.2 patch-sum
--- files/patch-sum	2000/08/14 14:57:54	1.2
+++ files/patch-sum	2001/01/03 12:49:58
@@ -14,3 +14,4 @@
 MD5 (patch-arrays) = 963e8978c12ad5f94eaf77764ff022bb
 MD5 (patch-mips) = 58fa6a9833af86543fc94239bd319cde
 MD5 (patch-powerpc) = f41758e5bf1f6e2f6ba7661f90cd2587
+MD5 (patch-sh) = 9ac7ce23853780ca8b15cb5930d61a27
Index: patches/patch-sh
===================================================================
RCS file: patch-sh
diff -N patch-sh
--- /dev/null	Wed Jan  3 11:53:01 2001
+++ patch-sh	Wed Jan  3 14:49:59 2001
@@ -0,0 +1,410 @@
+$NetBSD$
+
+ftp://ftp.netbsd.org/pub/NetBSD/arch/sh3/crosskit/
+
+diff -u -r -N -x *.orig -x CVS old/bfd/Makefile.am binutils-2.9.1/bfd/Makefile.am
+--- bfd/Makefile.am	Wed Jan  3 20:40:59 2001
++++ bfd/Makefile.am	Wed Jan  3 20:44:17 2001
+@@ -153,6 +153,7 @@
+ 	elf-m10200.lo \
+ 	elf-m10300.lo \
+ 	elf32-ppc.lo \
++	elf32-shunx.lo \
+ 	elf32-sh.lo \
+ 	elf32-sparc.lo \
+ 	elf32-v850.lo \
+@@ -260,6 +261,7 @@
+ 	elf-m10200.c \
+ 	elf-m10300.c \
+ 	elf32-ppc.c \
++	elf32-shunx.c \
+ 	elf32-sh.c \
+ 	elf32-sparc.c \
+ 	elf32-v850.c \
+@@ -797,6 +799,9 @@
+ elf32-ppc.lo: elf32-ppc.c $(INCDIR)/bfdlink.h elf-bfd.h \
+   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+   $(INCDIR)/elf/ppc.h elf32-target.h
++elf32-shunx.lo: elf32-shunx.c $(INCDIR)/bfdlink.h elf-bfd.h \
++  $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
++  elf32-target.h
+ elf32-sh.lo: elf32-sh.c $(INCDIR)/bfdlink.h elf-bfd.h \
+   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+   elf32-target.h
+diff -u -r -N -x *.orig -x CVS old/bfd/Makefile.in binutils-2.9.1/bfd/Makefile.in
+--- bfd/Makefile.in	Wed Jan  3 20:40:59 2001
++++ bfd/Makefile.in	Wed Jan  3 20:44:04 2001
+@@ -242,6 +242,7 @@
+ 	elf-m10200.lo \
+ 	elf-m10300.lo \
+ 	elf32-ppc.lo \
++	elf32-shunx.lo \
+ 	elf32-sh.lo \
+ 	elf32-sparc.lo \
+ 	elf32-v850.lo \
+@@ -349,6 +350,7 @@
+ 	elf-m10200.c \
+ 	elf-m10300.c \
+ 	elf32-ppc.c \
++	elf32-shunx.c \
+ 	elf32-sh.c \
+ 	elf32-sparc.c \
+ 	elf32-v850.c \
+@@ -1254,6 +1256,9 @@
+ elf32-ppc.lo: elf32-ppc.c $(INCDIR)/bfdlink.h elf-bfd.h \
+   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+   $(INCDIR)/elf/ppc.h elf32-target.h
++elf32-shunx.lo: elf32-shunx.c $(INCDIR)/bfdlink.h elf-bfd.h \
++  $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
++  elf32-target.h
+ elf32-sh.lo: elf32-sh.c $(INCDIR)/bfdlink.h elf-bfd.h \
+   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+   elf32-target.h
+diff -u -r -N -x *.orig -x CVS old/bfd/config.bfd binutils-2.9.1/bfd/config.bfd
+--- bfd/config.bfd	Wed Jan  3 20:55:42 2001
++++ bfd/config.bfd	Wed Jan  3 20:46:00 2001
+@@ -40,6 +40,7 @@
+ powerpc*) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
+ rs6000)	targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
+ sparc*)	targ_archs=bfd_sparc_arch ;;
++sh*)	targ_archs=bfd_sh_arch ;;
+ v850*)	targ_archs=bfd_v850_arch ;;
+ z8k*)	targ_archs=bfd_z8k_arch ;;
+ *)	targ_archs=bfd_${targ_cpu}_arch ;;
+@@ -494,14 +495,34 @@
+     targ_defvec=rs6000coff_vec
+     ;;
+ 
++  sh-*-netbsdelf)
++    targ_defvec=bfd_elf32_shunx_vec
++    targ_selvecs="bfd_elf32_shlunx_vec shcoff_vec shlcoff_vec "
++    targ_underscore=yes
++    ;;
++  shel-*-netbsdelf)
++    targ_defvec=bfd_elf32_shlunx_vec
++    targ_selvecs="bfd_elf32_shunx_vec shcoff_vec shlcoff_vec "
++    targ_underscore=yes
++    ;;
+   sh-*-elf*)
+     targ_defvec=bfd_elf32_sh_vec
+-    targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
++    targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec "
++    targ_underscore=yes
++    ;;
++  sh-*-netbsdcoff)
++    targ_defvec=shcoff_vec
++    targ_selvecs="shlcoff_vec "
++    targ_underscore=yes
++    ;;
++  shel-*-netbsdcoff)
++    targ_defvec=shlcoff_vec
++    targ_selvecs="shcoff_vec "
+     targ_underscore=yes
+     ;;
+   sh-*-* | sh-*-rtems*)
+     targ_defvec=shcoff_vec
+-    targ_selvecs="shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
++    targ_selvecs="shlcoff_vec "
+     targ_underscore=yes
+     ;;
+ 
+diff -u -r -N -x *.orig -x CVS old/bfd/configure binutils-2.9.1/bfd/configure
+--- bfd/configure	Wed Jan  3 20:40:59 2001
++++ bfd/configure	Wed Jan  3 20:46:23 2001
+@@ -2738,6 +2738,8 @@
+     bfd_elf32_mn10300_vec)	tb="$tb elf-m10300.lo elf32.lo $elf" ;;
+     bfd_elf32_powerpc_vec)	tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
+     bfd_elf32_powerpcle_vec)	tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
++    bfd_elf32_shunx_vec)	tb="$tb elf32-shunx.lo elf32.lo $elf coff-sh.lo" ;;
++    bfd_elf32_shlunx_vec)	tb="$tb elf32-shunx.lo elf32.lo $elf coff-sh.lo" ;;
+     bfd_elf32_sh_vec)		tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
+     bfd_elf32_shl_vec)		tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
+     bfd_elf32_sparc_vec)	tb="$tb elf32-sparc.lo elf32.lo $elf" ;;
+diff -u -r -N -x *.orig -x CVS old/bfd/configure.in binutils-2.9.1/bfd/configure.in
+--- bfd/configure.in	Wed Jan  3 20:40:59 2001
++++ bfd/configure.in	Wed Jan  3 20:46:30 2001
+@@ -423,6 +423,8 @@
+     bfd_elf32_mn10300_vec)	tb="$tb elf-m10300.lo elf32.lo $elf" ;;
+     bfd_elf32_powerpc_vec)	tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
+     bfd_elf32_powerpcle_vec)	tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
++    bfd_elf32_shunx_vec)	tb="$tb elf32-shunx.lo elf32.lo $elf coff-sh.lo" ;;
++    bfd_elf32_shlunx_vec)	tb="$tb elf32-shunx.lo elf32.lo $elf coff-sh.lo" ;;
+     bfd_elf32_sh_vec)		tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
+     bfd_elf32_shl_vec)		tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
+     bfd_elf32_sparc_vec)	tb="$tb elf32-sparc.lo elf32.lo $elf" ;;
+diff -u -r -N -x *.orig -x CVS old/bfd/elf32-sh.c binutils-2.9.1/bfd/elf32-sh.c
+--- bfd/elf32-sh.c	Sat May  2 00:48:09 1998
++++ bfd/elf32-sh.c	Wed Jan  3 20:47:15 2001
+@@ -1889,13 +1889,28 @@
+   return NULL;
+ }
+ 
++#ifndef TARGET_BIG_SYM
+ #define TARGET_BIG_SYM		bfd_elf32_sh_vec
++#endif
++
++#ifndef TARGET_BIG_NAME
+ #define TARGET_BIG_NAME		"elf32-sh"
++#endif
++
++#ifndef TARGET_LITTLE_SYM
+ #define TARGET_LITTLE_SYM	bfd_elf32_shl_vec
++#endif
++
++#ifndef TARGET_LITTLE_NAME
+ #define TARGET_LITTLE_NAME	"elf32-shl"
++#endif
++
+ #define ELF_ARCH		bfd_arch_sh
+ #define ELF_MACHINE_CODE	EM_SH
++
++#ifndef ELF_MAXPAGESIZE
+ #define ELF_MAXPAGESIZE		0x1
++#endif
+ 
+ #define elf_symbol_leading_char '_'
+ 
+diff -u -r -N -x *.orig -x CVS old/bfd/elf32-shunx.c binutils-2.9.1/bfd/elf32-shunx.c
+--- bfd/elf32-shunx.c	Thu Jan  1 09:00:00 1970
++++ bfd/elf32-shunx.c	Wed Jan  3 20:47:30 2001
+@@ -0,0 +1,7 @@
++#define TARGET_BIG_SYM                bfd_elf32_shunx_vec
++#define TARGET_BIG_NAME               "elf32-sh-unx"
++#define TARGET_LITTLE_SYM     bfd_elf32_shlunx_vec
++#define TARGET_LITTLE_NAME    "elf32-shl-unx"
++#define ELF_MAXPAGESIZE               0x1000
++
++#include "elf32-sh.c"
+diff -u -r -N -x *.orig -x CVS old/bfd/targets.c binutils-2.9.1/bfd/targets.c
+--- bfd/targets.c	Wed Jan  3 20:40:59 2001
++++ bfd/targets.c	Wed Jan  3 20:47:40 2001
+@@ -504,6 +504,8 @@
+ extern const bfd_target bfd_elf32_mn10300_vec;
+ extern const bfd_target bfd_elf32_powerpc_vec;
+ extern const bfd_target bfd_elf32_powerpcle_vec;
++extern const bfd_target bfd_elf32_shunx_vec;
++extern const bfd_target bfd_elf32_shlunx_vec;
+ extern const bfd_target bfd_elf32_sh_vec;
+ extern const bfd_target bfd_elf32_shl_vec;
+ extern const bfd_target bfd_elf32_sparc_vec;
+diff -u -r -N -x *.orig -x CVS old/config.sub binutils-2.9.1/config.sub
+--- config.sub	Wed Jan  3 20:41:00 2001
++++ config.sub	Wed Jan  3 20:47:56 2001
+@@ -175,7 +175,7 @@
+ 		| arme[lb] | pyramid | mn10200 | mn10300 \
+ 		| tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
+ 		| alpha | alphaev5 | alphaev56 | alphapca56 | alphaev6 \
+-		| we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \
++		| we32k | ns16k | clipper | i370 | sh | shel | powerpc | powerpcle \
+ 		| 1750a | dsp16xx | pdp11 \
+ 		| mips64 | mipsel | mipseb | mips64el | mips64orion | mips64orionel \
+ 		| mipstx39 | mipstx39el \
+@@ -229,7 +229,7 @@
+ 	      | alpha-* | alphaev5-* | alphaev56-* | alphapca56-* \
+ 	      | alphaev6-* | we32k-* | cydra-* | ns16k-* | pn-* | np1-* \
+ 	      | xps100-* | clipper-* | orion-* \
+-	      | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
++	      | sparclite-* | pdp11-* | sh-* | shel-* | powerpc-* | powerpcle-* \
+ 	      | sparc64-* | mips64-* | mipsel-* | mipseb-* \
+ 	      | mips64el-* | mips64orion-* | mips64orionel-* \
+ 	      | mipstx39-* | mipstx39el-* \
+diff -u -r -N -x *.orig -x CVS old/ld/Makefile.am binutils-2.9.1/ld/Makefile.am
+--- ld/Makefile.am	Wed Jan  3 20:40:59 2001
++++ ld/Makefile.am	Wed Jan  3 20:49:44 2001
+@@ -169,6 +169,10 @@
+ 	eshelf.o \
+ 	eshlelf.o \
+ 	eshl.o \
++	eshunx.o \
++	eshlunx.o \
++	eelf32shunx.o \
++	eelf32shlunx.o \
+ 	esparcaout.o \
+ 	esparclinux.o \
+ 	esparclynx.o \
+@@ -488,6 +492,18 @@
+ eshl.c: $(srcdir)/emulparams/shl.sh \
+   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS}
+ 	${GENSCRIPTS} shl "$(tdir_shl)"
++eshunx.c: $(srcdir)/emulparams/shunx.sh \
++  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS}
++	${GENSCRIPTS} shunx "$(tdir_shunx)"
++eshlunx.c: $(srcdir)/emulparams/shlunx.sh \
++  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS}
++	${GENSCRIPTS} shlunx "$(tdir_shlunx)"
++eelf32shunx.c: $(srcdir)/emulparams/elf32shunx.sh \
++  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS}
++	${GENSCRIPTS} elf32shunx "$(tdir_elf32shunx)"
++eelf32shlunx.c: $(srcdir)/emulparams/elf32shlunx.sh \
++  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS}
++	${GENSCRIPTS} elf32shlunx "$(tdir_elf32shlunx)"
+ esparcaout.c: $(srcdir)/emulparams/sparcaout.sh \
+   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
+ 	${GENSCRIPTS} sparcaout "$(tdir_sparcaout)"
+diff -u -r -N -x *.orig -x CVS old/ld/Makefile.in binutils-2.9.1/ld/Makefile.in
+--- ld/Makefile.in	Wed Jan  3 20:40:59 2001
++++ ld/Makefile.in	Wed Jan  3 20:49:38 2001
+@@ -245,6 +245,10 @@
+ 	eshelf.o \
+ 	eshlelf.o \
+ 	eshl.o \
++	eshunx.o \
++	eshlunx.o \
++	eelf32shunx.o \
++	eelf32shlunx.o \
+ 	esparcaout.o \
+ 	esparclinux.o \
+ 	esparclynx.o \
+@@ -998,6 +1002,18 @@
+ eshl.c: $(srcdir)/emulparams/shl.sh \
+   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS}
+ 	${GENSCRIPTS} shl "$(tdir_shl)"
++eshunx.c: $(srcdir)/emulparams/shunx.sh \
++  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS}
++	${GENSCRIPTS} shunx "$(tdir_shunx)"
++eshlunx.c: $(srcdir)/emulparams/shlunx.sh \
++  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS}
++	${GENSCRIPTS} shlunx "$(tdir_shlunx)"
++eelf32shunx.c: $(srcdir)/emulparams/elf32shunx.sh \
++  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS}
++	${GENSCRIPTS} elf32shunx "$(tdir_elf32shunx)"
++eelf32shlunx.c: $(srcdir)/emulparams/elf32shlunx.sh \
++  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS}
++	${GENSCRIPTS} elf32shlunx "$(tdir_elf32shlunx)"
+ esparcaout.c: $(srcdir)/emulparams/sparcaout.sh \
+   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
+ 	${GENSCRIPTS} sparcaout "$(tdir_sparcaout)"
+diff -u -r -N -x *.orig -x CVS old/ld/configure.tgt binutils-2.9.1/ld/configure.tgt
+--- ld/configure.tgt	Wed Jan  3 20:41:00 2001
++++ ld/configure.tgt	Wed Jan  3 20:51:01 2001
+@@ -114,8 +114,16 @@
+ 			targ_extra_emuls="h8500s h8500b h8500m h8500c"
+ 			;;
+ sh-*-elf*)		targ_emul=shelf
+-			targ_extra_emuls="shlelf sh shl"
++			targ_extra_emuls="shlelf shunx shlunx"
+ 			;;
++sh-*-netbsdelf)		targ_emul=elf32shunx
++			targ_extra_emuls="elf32shlunx shunx shlunx"
++			;;
++shel-*-netbsdelf)	targ_emul=elf32shlunx
++			targ_extra_emuls="elf32shunx shunx shlunx"
++			;;
++sh-*-netbsdcoff)	targ_emul=shunx; targ_extra_emuls=shlunx ;;
++shel-*-netbsdcoff)	targ_emul=shlunx; targ_extra_emuls=shunx ;;
+ sh-*-*|sh-*-rtems*)	targ_emul=sh; targ_extra_emuls=shl ;;
+ m68k-sony-*)		targ_emul=news ;;
+ m68k-hp-bsd*)		targ_emul=hp300bsd ;;
+diff -u -r -N -x *.orig -x CVS old/ld/emulparams/elf32shlunx.sh binutils-2.9.1/ld/emulparams/elf32shlunx.sh
+--- ld/emulparams/elf32shlunx.sh	Thu Jan  1 09:00:00 1970
++++ ld/emulparams/elf32shlunx.sh	Wed Jan  3 20:51:16 2001
+@@ -0,0 +1,15 @@
++SCRIPT_NAME=elf
++OUTPUT_FORMAT="elf32-shl-unx"
++TEXT_START_ADDR=0x1000
++MAXPAGESIZE=0x1000
++ARCH=sh
++MACHINE=
++TEMPLATE_NAME=elf32
++GENERATE_SHLIB_SCRIPT=yes
++
++# These are for compatibility with the COFF toolchain.
++ENTRY=start
++CTOR_START='___ctors = .;'
++CTOR_END='___ctors_end = .;'
++DTOR_START='___dtors = .;'
++DTOR_END='___dtors_end = .;'
+diff -u -r -N -x *.orig -x CVS old/ld/emulparams/elf32shunx.sh binutils-2.9.1/ld/emulparams/elf32shunx.sh
+--- ld/emulparams/elf32shunx.sh	Thu Jan  1 09:00:00 1970
++++ ld/emulparams/elf32shunx.sh	Wed Jan  3 20:51:33 2001
+@@ -0,0 +1,15 @@
++SCRIPT_NAME=elf
++OUTPUT_FORMAT="elf32-sh-unx"
++TEXT_START_ADDR=0x1000
++MAXPAGESIZE=0x1000
++ARCH=sh
++MACHINE=
++TEMPLATE_NAME=elf32
++GENERATE_SHLIB_SCRIPT=yes
++
++# These are for compatibility with the COFF toolchain.
++ENTRY=start
++CTOR_START='___ctors = .;'
++CTOR_END='___ctors_end = .;'
++DTOR_START='___dtors = .;'
++DTOR_END='___dtors_end = .;'
+diff -u -r -N -x *.orig -x CVS old/ld/emulparams/shlunx.sh binutils-2.9.1/ld/emulparams/shlunx.sh
+--- ld/emulparams/shlunx.sh	Thu Jan  1 09:00:00 1970
++++ ld/emulparams/shlunx.sh	Wed Jan  3 20:51:54 2001
+@@ -0,0 +1,5 @@
++SCRIPT_NAME=shunx
++OUTPUT_FORMAT="coff-shl"
++TEXT_START_ADDR=0x1000
++TARGET_PAGE_SIZE=0x1000
++ARCH=sh
+diff -u -r -N -x *.orig -x CVS old/ld/emulparams/shunx.sh binutils-2.9.1/ld/emulparams/shunx.sh
+--- ld/emulparams/shunx.sh	Thu Jan  1 09:00:00 1970
++++ ld/emulparams/shunx.sh	Wed Jan  3 20:52:04 2001
+@@ -0,0 +1,5 @@
++SCRIPT_NAME=shunx
++OUTPUT_FORMAT="coff-sh"
++TEXT_START_ADDR=0x1000
++TARGET_PAGE_SIZE=0x1000
++ARCH=sh
+diff -u -r -N -x *.orig -x CVS old/ld/scripttempl/shunx.sc binutils-2.9.1/ld/scripttempl/shunx.sc
+--- ld/scripttempl/shunx.sc	Thu Jan  1 09:00:00 1970
++++ ld/scripttempl/shunx.sc	Wed Jan  3 20:52:24 2001
+@@ -0,0 +1,53 @@
++TORS=".tors :
++  {
++    ___ctors = . ;
++    *(.ctors)
++    ___ctors_end = . ;
++    ___dtors = . ;
++    *(.dtors)
++    ___dtors_end = . ;
++  }"
++
++
++cat <<EOF
++OUTPUT_FORMAT("${OUTPUT_FORMAT}")
++OUTPUT_ARCH(${ARCH})
++${LIB_SEARCH_DIRS}
++
++SECTIONS
++{
++  . = ${TEXT_START_ADDR} + SIZEOF_HEADERS;
++  .text ALIGN(0x10):
++  {
++    *(.text)
++    *(.strings)
++    ${RELOCATING+ _etext = . ; }
++  }
++  ${CONSTRUCTING+${TORS}}
++  .data  ${RELOCATING+ ALIGN(${TARGET_PAGE_SIZE})} :
++  {
++    *(.data)
++    ${RELOCATING+ _edata = . ; }
++  }
++  .bss ${RELOCATING+ ALIGN(${TARGET_PAGE_SIZE})} :
++  {
++    ${RELOCATING+ _bss_start = . ; }
++    *(.bss)
++    *(COMMON)
++    ${RELOCATING+ _end = . ;  }
++  }
++  .stack :
++  {
++    ${RELOCATING+ _stack = . ; }
++    *(.stack)
++  }
++  .stab 0 ${RELOCATING+(NOLOAD)} :
++  {
++    *(.stab)
++  }
++  .stabstr 0 ${RELOCATING+(NOLOAD)} :
++  {
++    *(.stabstr)
++  }
++}
++EOF