OSDN Git Service

* config.gcc (sh[123456789l]*-*-*): Set cpu_type to sh.
[pf3gnuchains/gcc-fork.git] / gcc / config / sh / netbsd-elf.h
1 /* Definitions for SH running NetBSD using ELF
2    Copyright (C) 2002 Free Software Foundation, Inc.
3    Contributed by Wasabi Systems, Inc.
4
5 This file is part of GNU CC.
6
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.
11
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.
16
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.  */
21
22 /* Run-time Target Specification.  */
23 #undef TARGET_VERSION
24 #if TARGET_ENDIAN_DEFAULT == LITTLE_ENDIAN_BIT
25 #define TARGET_VERSION  fputs (" (NetBSD/shle ELF)", stderr);
26 #else
27 #define TARGET_VERSION  fputs (" (NetBSD/sh ELF)", stderr);
28 #endif
29
30 #define TARGET_OS_CPP_BUILTINS()                                        \
31   do                                                                    \
32     {                                                                   \
33       NETBSD_OS_CPP_BUILTINS_ELF();                                     \
34       builtin_define ("__NO_LEADING_UNDERSCORES__");                    \
35     }                                                                   \
36   while (0)
37
38 /* Provide a LINK_SPEC appropriate for a NetBSD/sh ELF target.
39    This is a copy of LINK_SPEC from <netbsd-elf.h> tweaked for
40    the SH target.  */
41
42 #undef LINK_SPEC
43 #define LINK_SPEC                                                       \
44   "%{assert*} %{R*}                                                     \
45    %{mb:-m shelf_nbsd}                                                  \
46    %{ml:-m shlelf_nbsd}                                                 \
47    %{mrelax:-relax}                                                     \
48    %{shared:-shared}                                                    \
49    %{!shared:                                                           \
50      -dc -dp                                                            \
51      %{!nostdlib:                                                       \
52        %{!r*:                                                           \
53          %{!e*:-e __start}}}                                            \
54      %{!static:                                                         \
55        %{rdynamic:-export-dynamic}                                      \
56        %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}       \
57      %{static:-static}}"
58
59
60 /* Provide a CPP_SPEC appropriate for NetBSD.  */
61 #undef SUBTARGET_CPP_SPEC
62 #define SUBTARGET_CPP_SPEC NETBSD_CPP_SPEC
63
64 /* Restore the ASM_SPEC from sh/sh.h; sh/elf.h clobbers it.  */
65 #undef ASM_SPEC
66 #define ASM_SPEC  "%(subtarget_asm_endian_spec) %{mrelax:-relax}"
67
68 #undef TARGET_DEFAULT
69 #define TARGET_DEFAULT \
70   (SH1_BIT|SH2_BIT|SH3_BIT | USERMODE_BIT | TARGET_ENDIAN_DEFAULT)
71
72  
73 #undef FUNCTION_PROFILER
74 #define FUNCTION_PROFILER(STREAM,LABELNO)                               \
75 do                                                                      \
76   {                                                                     \
77     fprintf((STREAM), "\tmov.l\t%cLP%d,r1\n",                           \
78             LOCAL_LABEL_PREFIX, (LABELNO));                             \
79     fprintf((STREAM), "\tmova\t%cLP%dr,r0\n",                           \
80             LOCAL_LABEL_PREFIX, (LABELNO));                             \
81     fprintf((STREAM), "\tjmp\t@r1\n");                                  \
82     fprintf((STREAM), "\tnop\n");                                       \
83     fprintf((STREAM), "\t.align\t2\n");                                 \
84     fprintf((STREAM), "%cLP%d:\t.long\t__mcount\n",                     \
85             LOCAL_LABEL_PREFIX, (LABELNO));                             \
86     fprintf((STREAM), "%cLP%dr:\n", LOCAL_LABEL_PREFIX, (LABELNO));     \
87   }                                                                     \
88 while (0)