* config.gcc (sh5-*-netbsd*, sh5l*-*-netbsd*)

(sh64-*-netbsd*, sh64l*-*-netbsd*): New targets.
* config/sh/netbsd-elf.h (TARGET_VERSION_ENDIAN)
(TARGET_VERSION_CPU): Define according to the
default target.
(TARGET_VERSION): Use TARGET_VERSION_ENDIAN and
TARGET_VERSION_CPU.
(TARGET_OS_CPP_BUILTINS): Use NETBSD_OS_CPP_BUILTINS_LP64
if TARGET_SHMEDIA64.
(LINK_DEFAULT_CPU_EMUL): Define according to the
default target.
(SUBTARGET_LINK_EMUL_SUFFIX): Define.
(SUBTARGET_LINK_SPEC): Define.
(LINK_SPEC): Use SH_LINK_SPEC.
(ASM_SPEC): Remove.
(TARGET_DEFAULT): Use TARGET_CPU_DEFAULT.
(FUNCTION_PROFILER): Add cases for TARGET_SHMEDIA32
and TARGET_SHMEDIA64 which abort, for now.
* config/sh/t-netbsd-sh5: New file.
* config/sh/t-netbsd-sh5-32: New file.
* config/sh/t-netbsd-sh5-64: New file.

From-SVN: r54230
This commit is contained in:
Jason Thorpe 2002-06-04 05:02:44 +00:00 committed by Jason Thorpe
parent 6d8fd7bbd7
commit b655555e33
6 changed files with 144 additions and 37 deletions

View file

@ -1,3 +1,27 @@
2002-06-04 Jason Thorpe <thorpej@wasabisystems.com>
* config.gcc (sh5-*-netbsd*, sh5l*-*-netbsd*)
(sh64-*-netbsd*, sh64l*-*-netbsd*): New targets.
* config/sh/netbsd-elf.h (TARGET_VERSION_ENDIAN)
(TARGET_VERSION_CPU): Define according to the
default target.
(TARGET_VERSION): Use TARGET_VERSION_ENDIAN and
TARGET_VERSION_CPU.
(TARGET_OS_CPP_BUILTINS): Use NETBSD_OS_CPP_BUILTINS_LP64
if TARGET_SHMEDIA64.
(LINK_DEFAULT_CPU_EMUL): Define according to the
default target.
(SUBTARGET_LINK_EMUL_SUFFIX): Define.
(SUBTARGET_LINK_SPEC): Define.
(LINK_SPEC): Use SH_LINK_SPEC.
(ASM_SPEC): Remove.
(TARGET_DEFAULT): Use TARGET_CPU_DEFAULT.
(FUNCTION_PROFILER): Add cases for TARGET_SHMEDIA32
and TARGET_SHMEDIA64 which abort, for now.
* config/sh/t-netbsd-sh5: New file.
* config/sh/t-netbsd-sh5-32: New file.
* config/sh/t-netbsd-sh5-64: New file.
2002-06-03 Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
Richard Henderson <rth@redhat.com>

View file

@ -2248,7 +2248,8 @@ sh-*-linux*)
fi
float_format=sh
;;
sh-*-netbsdelf* | shl*-*-netbsdelf*)
sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
sh64-*-netbsd* | sh64l*-*-netbsd*)
tm_file="${tm_file} dbxelf.h elfos.h sh/elf.h netbsd.h netbsd-elf.h sh/netbsd-elf.h"
tmake_file="${tmake_file} sh/t-sh sh/t-elf"
case $machine in
@ -2260,7 +2261,23 @@ sh-*-netbsdelf* | shl*-*-netbsdelf*)
tmake_file="${tmake_file} sh/t-be"
;;
esac
tmake_file="${tmake_file} sh/t-netbsd"
case $machine in
sh5*-*)
# SHmedia, 32-bit ABI
target_cpu_default="SH5_BIT|SH4_BIT|SH3E_BIT"
tmake_file="${tmake_file} sh/t-netbsd-sh5 sh/t-netbsd-sh5-32"
;;
sh64*-*)
# SHmedia, 64-bit ABI
target_cpu_default="SH5_BIT|SH4_BIT"
tmake_file="${tmake_file} sh/t-netbsd-sh5 sh/t-netbsd-sh5-64"
;;
*)
# SH3, software floating point
target_cpu_default="SH1_BIT|SH2_BIT|SH3_BIT"
tmake_file="${tmake_file} sh/t-netbsd"
;;
esac
float_format=sh
;;
sh-*-*)

View file

@ -20,69 +20,111 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Run-time Target Specification. */
#undef TARGET_VERSION
#if TARGET_ENDIAN_DEFAULT == LITTLE_ENDIAN_BIT
#define TARGET_VERSION fputs (" (NetBSD/shle ELF)", stderr);
#define TARGET_VERSION_ENDIAN "le"
#else
#define TARGET_VERSION fputs (" (NetBSD/sh ELF)", stderr);
#define TARGET_VERSION_ENDIAN ""
#endif
#if TARGET_CPU_DEFAULT & SH5_BIT
#if TARGET_CPU_DEFAULT & SH3E_BIT
#define TARGET_VERSION_CPU "sh5"
#else
#define TARGET_VERSION_CPU "sh64"
#endif /* SH3E_BIT */
#else
#define TARGET_VERSION_CPU "sh"
#endif /* SH5_BIT */
#undef TARGET_VERSION
#define TARGET_VERSION fprintf (stderr, " (NetBSD/%s%s ELF)", \
TARGET_VERSION_CPU, TARGET_VERSION_ENDIAN)
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
NETBSD_OS_CPP_BUILTINS_ELF(); \
if (TARGET_SHMEDIA64) \
NETBSD_OS_CPP_BUILTINS_LP64(); \
builtin_define ("__NO_LEADING_UNDERSCORES__"); \
} \
while (0)
/* Provide a LINK_SPEC appropriate for a NetBSD/sh ELF target.
This is a copy of LINK_SPEC from <netbsd-elf.h> tweaked for
the SH target. */
We use the SH_LINK_SPEC from sh/sh.h, and define the appropriate
SUBTARGET_LINK_SPEC that pulls in what we need from a generic
NetBSD ELF LINK_SPEC. */
/* LINK_EMUL_PREFIX from sh/elf.h */
#undef LINK_DEFAULT_CPU_EMUL
#if TARGET_CPU_DEFAULT & SH5_BIT
#if TARGET_CPU_DEFAULT & SH3E_BIT
#define LINK_DEFAULT_CPU_EMUL "32"
#else
#define LINK_DEFAULT_CPU_EMUL "64"
#endif /* SH3E_BIT */
#else
#define LINK_DEFAULT_CPU_EMUL ""
#endif /* SH5_BIT */
#undef SUBTARGET_LINK_EMUL_SUFFIX
#define SUBTARGET_LINK_EMUL_SUFFIX "_nbsd"
#undef SUBTARGET_LINK_SPEC
#define SUBTARGET_LINK_SPEC \
"%{assert*} %{R*} \
%{shared:-shared} \
%{!shared: \
-dc -dp \
%{!nostdlib: \
%{!r*: \
%{!e*:-e __start}}} \
%{!static: \
%{rdynamic:-export-dynamic} \
%{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
%{static:-static}}"
#undef LINK_SPEC
#define LINK_SPEC \
"%{assert*} %{R*} \
%{mb:-m shelf_nbsd} \
%{ml:-m shlelf_nbsd} \
%{mrelax:-relax} \
%{shared:-shared} \
%{!shared: \
-dc -dp \
%{!nostdlib: \
%{!r*: \
%{!e*:-e __start}}} \
%{!static: \
%{rdynamic:-export-dynamic} \
%{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
%{static:-static}}"
#define LINK_SPEC SH_LINK_SPEC
/* Provide a CPP_SPEC appropriate for NetBSD. */
#undef SUBTARGET_CPP_SPEC
#define SUBTARGET_CPP_SPEC NETBSD_CPP_SPEC
/* Restore the ASM_SPEC from sh/sh.h; sh/elf.h clobbers it. */
#undef ASM_SPEC
#define ASM_SPEC "%(subtarget_asm_endian_spec) %{mrelax:-relax}"
#undef TARGET_DEFAULT
#define TARGET_DEFAULT \
(SH1_BIT|SH2_BIT|SH3_BIT | USERMODE_BIT | TARGET_ENDIAN_DEFAULT)
(TARGET_CPU_DEFAULT | USERMODE_BIT | TARGET_ENDIAN_DEFAULT)
#undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(STREAM,LABELNO) \
do \
{ \
fprintf((STREAM), "\tmov.l\t%cLP%d,r1\n", \
LOCAL_LABEL_PREFIX, (LABELNO)); \
fprintf((STREAM), "\tmova\t%cLP%dr,r0\n", \
LOCAL_LABEL_PREFIX, (LABELNO)); \
fprintf((STREAM), "\tjmp\t@r1\n"); \
fprintf((STREAM), "\tnop\n"); \
fprintf((STREAM), "\t.align\t2\n"); \
fprintf((STREAM), "%cLP%d:\t.long\t__mcount\n", \
LOCAL_LABEL_PREFIX, (LABELNO)); \
fprintf((STREAM), "%cLP%dr:\n", LOCAL_LABEL_PREFIX, (LABELNO)); \
if (TARGET_SHMEDIA32) \
{ \
/* FIXME */ \
abort (); \
} \
else if (TARGET_SHMEDIA64) \
{ \
/* FIXME */ \
abort (); \
} \
else \
{ \
fprintf((STREAM), "\tmov.l\t%cLP%d,r1\n", \
LOCAL_LABEL_PREFIX, (LABELNO)); \
fprintf((STREAM), "\tmova\t%cLP%dr,r0\n", \
LOCAL_LABEL_PREFIX, (LABELNO)); \
fprintf((STREAM), "\tjmp\t@r1\n"); \
fprintf((STREAM), "\tnop\n"); \
fprintf((STREAM), "\t.align\t2\n"); \
fprintf((STREAM), "%cLP%d:\t.long\t__mcount\n", \
LOCAL_LABEL_PREFIX, (LABELNO)); \
fprintf((STREAM), "%cLP%dr:\n", LOCAL_LABEL_PREFIX, (LABELNO)); \
} \
} \
while (0)

View file

@ -0,0 +1,18 @@
TARGET_LIBGCC2_CFLAGS = -fpic
LIB1ASMFUNCS = \
_sdivsi3 _sdivsi3_i4 _udivsi3 _udivsi3_i4 _set_fpscr \
_shcompact_call_trampoline _shcompact_return_trampoline \
_shcompact_incoming_args _ic_invalidate _nested_trampoline \
_push_pop_shmedia_regs
LIB2FUNCS_EXTRA=
EXTRA_MULTILIB_PARTS=
# NetBSD's C library includes a fast software FP library that
# has support for setting/setting the rounding mode, exception
# mask, etc. Therefore, we don't want to include software FP
# in libgcc.
FPBIT =
DPBIT =

View file

@ -0,0 +1,3 @@
MULTILIB_OPTIONS += m5-32media-nofpu/m5-compact/m5-compact-nofpu/m5-64media/m5-64media-nofpu
MULTILIB_DIRNAMES=
MULTILIB_MATCHES =

View file

@ -0,0 +1,3 @@
MULTILIB_OPTIONS += m5-64media-nofpu/m5-compact/m5-compact-nofpu/m5-32media/m5-32media-nofpu
MULTILIB_DIRNAMES=
MULTILIB_MATCHES =