Add x prefix to v850e case for handling --with-cpu=v850e.
[official-gcc.git] / gcc / config / sh / netbsd-elf.h
blob513b39f4704a751d774f0c48f52bc42b95301868
1 /* Definitions for SH running NetBSD using ELF
2 Copyright (C) 2002 Free Software Foundation, Inc.
3 Contributed by Wasabi Systems, Inc.
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 /* Run-time Target Specification. */
23 #if TARGET_ENDIAN_DEFAULT == LITTLE_ENDIAN_BIT
24 #define TARGET_VERSION_ENDIAN "le"
25 #else
26 #define TARGET_VERSION_ENDIAN ""
27 #endif
29 #if TARGET_CPU_DEFAULT & SH5_BIT
30 #if TARGET_CPU_DEFAULT & SH3E_BIT
31 #define TARGET_VERSION_CPU "sh5"
32 #else
33 #define TARGET_VERSION_CPU "sh64"
34 #endif /* SH3E_BIT */
35 #else
36 #define TARGET_VERSION_CPU "sh"
37 #endif /* SH5_BIT */
39 #undef TARGET_VERSION
40 #define TARGET_VERSION fprintf (stderr, " (NetBSD/%s%s ELF)", \
41 TARGET_VERSION_CPU, TARGET_VERSION_ENDIAN)
44 /* Extra specs needed for NetBSD SuperH ELF targets. */
46 #undef SUBTARGET_EXTRA_SPECS
47 #define SUBTARGET_EXTRA_SPECS \
48 { "netbsd_entry_point", NETBSD_ENTRY_POINT },
51 #define TARGET_OS_CPP_BUILTINS() \
52 do \
53 { \
54 NETBSD_OS_CPP_BUILTINS_ELF(); \
55 if (TARGET_SHMEDIA64) \
56 NETBSD_OS_CPP_BUILTINS_LP64(); \
57 builtin_define ("__NO_LEADING_UNDERSCORES__"); \
58 } \
59 while (0)
61 /* Provide a LINK_SPEC appropriate for a NetBSD/sh ELF target.
62 We use the SH_LINK_SPEC from sh/sh.h, and define the appropriate
63 SUBTARGET_LINK_SPEC that pulls in what we need from a generic
64 NetBSD ELF LINK_SPEC. */
66 /* LINK_EMUL_PREFIX from sh/elf.h */
68 #undef LINK_DEFAULT_CPU_EMUL
69 #if TARGET_CPU_DEFAULT & SH5_BIT
70 #if TARGET_CPU_DEFAULT & SH3E_BIT
71 #define LINK_DEFAULT_CPU_EMUL "32"
72 #else
73 #define LINK_DEFAULT_CPU_EMUL "64"
74 #endif /* SH3E_BIT */
75 #else
76 #define LINK_DEFAULT_CPU_EMUL ""
77 #endif /* SH5_BIT */
79 #undef SUBTARGET_LINK_EMUL_SUFFIX
80 #define SUBTARGET_LINK_EMUL_SUFFIX "_nbsd"
82 #undef SUBTARGET_LINK_SPEC
83 #define SUBTARGET_LINK_SPEC NETBSD_LINK_SPEC_ELF
85 #undef LINK_SPEC
86 #define LINK_SPEC SH_LINK_SPEC
88 #define NETBSD_ENTRY_POINT "__start"
90 /* Provide a CPP_SPEC appropriate for NetBSD. */
91 #undef SUBTARGET_CPP_SPEC
92 #define SUBTARGET_CPP_SPEC NETBSD_CPP_SPEC
94 #undef TARGET_DEFAULT
95 #define TARGET_DEFAULT \
96 (TARGET_CPU_DEFAULT | USERMODE_BIT | TARGET_ENDIAN_DEFAULT)
99 #undef FUNCTION_PROFILER
100 #define FUNCTION_PROFILER(STREAM,LABELNO) \
101 do \
103 if (TARGET_SHMEDIA32) \
105 /* FIXME */ \
106 abort (); \
108 else if (TARGET_SHMEDIA64) \
110 /* FIXME */ \
111 abort (); \
113 else \
115 fprintf((STREAM), "\tmov.l\t%sLP%d,r1\n", \
116 LOCAL_LABEL_PREFIX, (LABELNO)); \
117 fprintf((STREAM), "\tmova\t%sLP%dr,r0\n", \
118 LOCAL_LABEL_PREFIX, (LABELNO)); \
119 fprintf((STREAM), "\tjmp\t@r1\n"); \
120 fprintf((STREAM), "\tnop\n"); \
121 fprintf((STREAM), "\t.align\t2\n"); \
122 fprintf((STREAM), "%sLP%d:\t.long\t__mcount\n", \
123 LOCAL_LABEL_PREFIX, (LABELNO)); \
124 fprintf((STREAM), "%sLP%dr:\n", LOCAL_LABEL_PREFIX, (LABELNO)); \
127 while (0)