OSDN Git Service

3f46c2cf27fe82b876b76c36b3ae6bfcb5665560
[pf3gnuchains/gcc-fork.git] / gcc / config / rs6000 / vxworks.h
1 /* Definitions of target machine for GNU compiler.  Vxworks PowerPC version.
2    Copyright (C) 1996, 2000, 2002, 2003, 2004, 2005, 2007, 2009, 2010
3    Free Software Foundation, Inc.
4    Contributed by CodeSourcery, LLC.
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3.  If not see
20 <http://www.gnu.org/licenses/>.  */
21
22 /* Note to future editors: VxWorks is mostly an EABI target.  We do
23    not use rs6000/eabi.h because we would have to override most of
24    it anyway.  However, if you change that file, consider making
25    analogous changes here too.  */
26
27 #undef TARGET_VERSION
28 #define TARGET_VERSION fprintf (stderr, " (PowerPC VxWorks)");
29
30 /* CPP predefined macros.  */
31
32 #undef TARGET_OS_CPP_BUILTINS
33 #define TARGET_OS_CPP_BUILTINS()                \
34   do                                            \
35     {                                           \
36       builtin_define ("__ppc");                 \
37       builtin_define ("__PPC__");               \
38       builtin_define ("__EABI__");              \
39       builtin_define ("__ELF__");               \
40       if (!TARGET_SOFT_FLOAT)                   \
41         builtin_define ("__hardfp");            \
42                                                 \
43       /* C89 namespace violation! */            \
44       builtin_define ("CPU_FAMILY=PPC");        \
45                                                 \
46       VXWORKS_OS_CPP_BUILTINS ();               \
47     }           \
48   while (0)
49
50 /* Only big endian PPC is supported by VxWorks.  */
51 #undef BYTES_BIG_ENDIAN
52 #define BYTES_BIG_ENDIAN 1
53
54 /* We have to kill off the entire specs set created by rs6000/sysv4.h
55    and substitute our own set.  The top level vxworks.h has done some
56    of this for us.  */
57
58 #undef SUBTARGET_EXTRA_SPECS
59 #undef CPP_SPEC
60 #undef CC1_SPEC
61 #undef ASM_SPEC
62
63 #define SUBTARGET_EXTRA_SPECS /* none needed */
64
65 /* FIXME: The only reason we allow no -mcpu switch at all is because
66    config-ml.in insists on a "." multilib. */
67 #define CPP_SPEC \
68 "%{!DCPU=*:               \
69    %{mcpu=403 : -DCPU=PPC403  ; \
70      mcpu=405 : -DCPU=PPC405  ; \
71      mcpu=440 : -DCPU=PPC440  ; \
72      mcpu=464 : -DCPU=PPC464  ; \
73      mcpu=476 : -DCPU=PPC476  ; \
74      mcpu=603 : -DCPU=PPC603  ; \
75      mcpu=604 : -DCPU=PPC604  ; \
76      mcpu=860 : -DCPU=PPC860  ; \
77      mcpu=8540: -DCPU=PPC85XX ; \
78               : -DCPU=PPC604  }}" \
79 VXWORKS_ADDITIONAL_CPP_SPEC
80
81 #define CC1_SPEC                                                \
82 "%{G*} %{mno-sdata:-msdata=none} %{msdata:-msdata=default}      \
83  %{mlittle|mlittle-endian:-mstrict-align}                       \
84  %{profile: -p}         \
85  %{fvec:-maltivec} %{fvec-eabi:-maltivec -mabi=altivec}"
86
87 #define ASM_SPEC \
88 "%(asm_cpu) \
89  %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \
90  %{v:-v} %{Qy:} %{!Qn:-Qy} %{Ym,*} %{Yd,*} \
91  %{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} -mbig"
92
93 #undef  LIB_SPEC
94 #define LIB_SPEC VXWORKS_LIB_SPEC
95 #undef  LINK_SPEC
96 #define LINK_SPEC VXWORKS_LINK_SPEC
97 #undef  STARTFILE_SPEC
98 #define STARTFILE_SPEC VXWORKS_STARTFILE_SPEC
99 #undef  ENDFILE_SPEC
100 #define ENDFILE_SPEC VXWORKS_ENDFILE_SPEC
101
102 /* There is no default multilib.  */
103 #undef MULTILIB_DEFAULTS
104
105 #undef TARGET_DEFAULT
106 #define TARGET_DEFAULT \
107   (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_EABI | MASK_STRICT_ALIGN)
108
109 #undef PROCESSOR_DEFAULT
110 #define PROCESSOR_DEFAULT PROCESSOR_PPC604
111
112 /* Nor sdata, for kernel mode.  We use this in
113    SUBSUBTARGET_INITIALIZE_OPTIONS, after rs6000_rtp has been initialized.  */
114 #undef SDATA_DEFAULT_SIZE
115 #define SDATA_DEFAULT_SIZE (TARGET_VXWORKS_RTP ? 8 : 0)
116
117 /* Enforce 16bytes alignment for the stack pointer, to permit general
118    compliance with e.g. Altivec instructions requirements.  Make sure
119    this isn't overruled by the EABI constraints.  */
120
121 #undef  STACK_BOUNDARY
122 #define STACK_BOUNDARY (16*BITS_PER_UNIT)
123
124 #undef  PREFERRED_STACK_BOUNDARY
125 #define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY
126
127 #undef  ABI_STACK_BOUNDARY
128
129 /* Make -mcpu=8540 imply SPE.  ISEL is automatically enabled, the
130    others must be done by hand.  Handle -mrtp.  Disable -fPIC
131    for -mrtp - the VxWorks PIC model is not compatible with it.  */
132 #undef SUBSUBTARGET_OVERRIDE_OPTIONS
133 #define SUBSUBTARGET_OVERRIDE_OPTIONS           \
134   do {                                          \
135     if (TARGET_E500)                            \
136       {                                         \
137         rs6000_spe = 1;                         \
138         rs6000_spe_abi = 1;                     \
139         rs6000_float_gprs = 1;                  \
140       }                                         \
141                                                 \
142   if (!global_options_set.x_g_switch_value)     \
143     g_switch_value = SDATA_DEFAULT_SIZE;        \
144   VXWORKS_OVERRIDE_OPTIONS;                     \
145   } while (0)
146
147 /* No _mcount profiling on VxWorks.  */
148 #undef FUNCTION_PROFILER
149 #define FUNCTION_PROFILER(FILE,LABELNO) VXWORKS_FUNCTION_PROFILER(FILE,LABELNO)