ld.new for NetBSD/sh3

This commit is contained in:
msaitoh 1999-12-26 19:59:22 +00:00
parent bec61173c4
commit 5efb71755d
8 changed files with 129 additions and 2 deletions

View File

@ -488,6 +488,18 @@ eshlelf.c: $(srcdir)/emulparams/shlelf.sh \
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/shunx.sc ${GEN_DEPENDS}
${GENSCRIPTS} shlunx "$(tdir_shlunx)"
eelf32shunx.c: $(srcdir)/emulparams/elf32shunx.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32shunx "$(tdir_elf32shunx)"
eelf32shlunx.c: $(srcdir)/emulparams/elf32shlunx.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.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)"

View File

@ -998,6 +998,18 @@ eshlelf.c: $(srcdir)/emulparams/shlelf.sh \
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/shunx.sc ${GEN_DEPENDS}
${GENSCRIPTS} shlunx "$(tdir_shlunx)"
eelf32shunx.c: $(srcdir)/emulparams/elf32shunx.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
${GENSCRIPTS} elf32shunx "$(tdir_elf32shunx)"
eelf32shlunx.c: $(srcdir)/emulparams/elf32shlunx.sh \
$(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.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)"

15
gnu/dist/ld/emulparams/elf32shlunx.sh vendored Normal file
View File

@ -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 = .;'

15
gnu/dist/ld/emulparams/elf32shunx.sh vendored Normal file
View File

@ -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 = .;'

5
gnu/dist/ld/emulparams/shlunx.sh vendored Normal file
View File

@ -0,0 +1,5 @@
SCRIPT_NAME=shunx
OUTPUT_FORMAT="coff-shl"
TEXT_START_ADDR=0x1000
TARGET_PAGE_SIZE=0x1000
ARCH=sh

5
gnu/dist/ld/emulparams/shunx.sh vendored Normal file
View File

@ -0,0 +1,5 @@
SCRIPT_NAME=shunx
OUTPUT_FORMAT="coff-sh"
TEXT_START_ADDR=0x1000
TARGET_PAGE_SIZE=0x1000
ARCH=sh

53
gnu/dist/ld/scripttempl/shunx.sc vendored Normal file
View File

@ -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

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.15 1999/08/21 06:30:12 simonb Exp $
# $NetBSD: Makefile,v 1.16 1999/12/26 19:59:23 msaitoh Exp $
# for OBJECT_FMT, UNPRIVILEGED
.include <bsd.own.mk>
@ -13,6 +13,7 @@ ELF_PLEASE=
(${MACHINE_ARCH} == "mipseb") || \
(${MACHINE_ARCH} == "mipsel") || \
(${MACHINE_ARCH} == "powerpc") || \
(${MACHINE_ARCH} == "sh3") || \
(${MACHINE_ARCH} == "sparc" && defined(ELF_PLEASE)) || \
(${MACHINE_ARCH} == "sparc64")
PROG= ld
@ -72,6 +73,14 @@ DEFAULT_EMUL.mipsel= elf32lmip
EMULS.powerpc= elf32ppc
DEFAULT_EMUL.powerpc= elf32ppc
##### sh3 #####
EMULS.sh3= shunx shlunx elf32shunx elf32shlunx
.if defined(ELF_PLEASE)
DEFAULT_EMUL.sh3= elf32shunx
.else
DEFAULT_EMUL.sh3= shunx
.endif
##### sparc #####
EMULS.sparc= sparcnbsd elf32_sparc sun4
.if defined(ELF_PLEASE)
@ -86,7 +95,8 @@ DEFAULT_EMUL.sparc64= elf64_sparc
ALL_EMULS!= (for i in ${EMULS.alpha} ${EMULS.i386} ${EMULS.m68k} \
${EMULS.mipseb} ${EMULS.mipsel} ${EMULS.powerpc} \
${EMULS.sparc} ${EMULS.sparc64}; do echo $$i; done) | \
${EMULS.sh3} ${EMULS.sparc} ${EMULS.sparc64}; \
do echo $$i; done) | \
sort | uniq
LIB_PATH= ${LIBDIR} # passed to genscripts