1132718Skan/* Definitions of target machine for GNU compiler.  Vxworks PowerPC version.
2169689Skan   Copyright (C) 1996, 2000, 2002, 2003, 2004, 2005
3169689Skan   Free Software Foundation, Inc.
4169689Skan   Contributed by CodeSourcery, LLC.
5132718Skan
6169689SkanThis file is part of GCC.
7132718Skan
8169689SkanGCC is free software; you can redistribute it and/or modify it under
9169689Skanthe terms of the GNU General Public License as published by the Free
10169689SkanSoftware Foundation; either version 2, or (at your option) any later
11169689Skanversion.
12132718Skan
13169689SkanGCC is distributed in the hope that it will be useful, but WITHOUT ANY
14169689SkanWARRANTY; without even the implied warranty of MERCHANTABILITY or
15169689SkanFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16169689Skanfor more details.
17132718Skan
18169689SkanYou should have received a copy of the GNU General Public License
19169689Skanalong with GCC; see the file COPYING.  If not, write to the Free
20169689SkanSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
21169689Skan02110-1301, USA.  */
22132718Skan
23169689Skan/* Note to future editors: VxWorks is mostly an EABI target.  We do
24169689Skan   not use rs6000/eabi.h because we would have to override most of
25169689Skan   it anyway.  However, if you change that file, consider making
26169689Skan   analogous changes here too.  */
27169689Skan
28169689Skan#undef TARGET_VERSION
29169689Skan#define TARGET_VERSION fprintf (stderr, " (PowerPC VxWorks)");
30169689Skan
31169689Skan/* CPP predefined macros.  */
32169689Skan
33169689Skan#undef TARGET_OS_CPP_BUILTINS
34132718Skan#define TARGET_OS_CPP_BUILTINS()		\
35132718Skan  do						\
36132718Skan    {						\
37169689Skan      builtin_define ("__ppc");			\
38169689Skan      builtin_define ("__EABI__");		\
39169689Skan      builtin_define ("__ELF__");		\
40132718Skan      builtin_define ("__vxworks");		\
41169689Skan      builtin_define ("__VXWORKS__");		\
42169689Skan      if (!TARGET_SOFT_FLOAT)			\
43169689Skan	builtin_define ("__hardfp");		\
44169689Skan						\
45169689Skan      /* C89 namespace violation! */		\
46169689Skan      builtin_define ("CPU_FAMILY=PPC");	\
47132718Skan    }						\
48132718Skan  while (0)
49132718Skan
50169689Skan/* Only big endian PPC is supported by VxWorks.  */
51169689Skan#undef BYTES_BIG_ENDIAN
52169689Skan#define BYTES_BIG_ENDIAN 1
53169689Skan
54132718Skan/* We have to kill off the entire specs set created by rs6000/sysv4.h
55132718Skan   and substitute our own set.  The top level vxworks.h has done some
56132718Skan   of this for us.  */
57132718Skan
58132718Skan#undef SUBTARGET_EXTRA_SPECS
59132718Skan#undef CPP_SPEC
60132718Skan#undef CC1_SPEC
61132718Skan#undef ASM_SPEC
62132718Skan
63132718Skan#define SUBTARGET_EXTRA_SPECS /* none needed */
64132718Skan
65169689Skan/* FIXME: The only reason we allow no -mcpu switch at all is because
66169689Skan   config-ml.in insists on a "." multilib. */
67132718Skan#define CPP_SPEC \
68169689Skan"%{!DCPU=*:		  \
69169689Skan   %{mcpu=403 : -DCPU=PPC403  ; \
70169689Skan     mcpu=405 : -DCPU=PPC405  ; \
71169689Skan     mcpu=440 : -DCPU=PPC440  ; \
72169689Skan     mcpu=603 : -DCPU=PPC603  ; \
73169689Skan     mcpu=604 : -DCPU=PPC604  ; \
74169689Skan     mcpu=860 : -DCPU=PPC860  ; \
75169689Skan     mcpu=8540: -DCPU=PPC85XX ; \
76169689Skan              : -DCPU=PPC604  }}" \
77169689SkanVXWORKS_ADDITIONAL_CPP_SPEC
78132718Skan
79169689Skan#define CC1_SPEC						\
80169689Skan"%{G*} %{mno-sdata:-msdata=none} %{msdata:-msdata=default}	\
81132718Skan %{mlittle|mlittle-endian:-mstrict-align}			\
82169689Skan %{profile: -p}		\
83132718Skan %{fvec:-maltivec} %{fvec-eabi:-maltivec -mabi=altivec}"
84132718Skan
85169689Skan#define ASM_SPEC \
86169689Skan"%(asm_cpu) \
87169689Skan %{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \
88169689Skan %{v:-v} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
89169689Skan %{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} -mbig"
90132718Skan
91169689Skan#undef  LIB_SPEC
92169689Skan#define LIB_SPEC VXWORKS_LIB_SPEC
93169689Skan#undef  LINK_SPEC
94169689Skan#define LINK_SPEC VXWORKS_LINK_SPEC
95169689Skan#undef  STARTFILE_SPEC
96169689Skan#define STARTFILE_SPEC VXWORKS_STARTFILE_SPEC
97169689Skan#undef  ENDFILE_SPEC
98169689Skan#define ENDFILE_SPEC VXWORKS_ENDFILE_SPEC
99132718Skan
100169689Skan/* There is no default multilib.  */
101169689Skan#undef MULTILIB_DEFAULTS
102169689Skan
103169689Skan#undef TARGET_DEFAULT
104169689Skan#define TARGET_DEFAULT \
105169689Skan  (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_EABI | MASK_STRICT_ALIGN)
106169689Skan
107169689Skan#undef PROCESSOR_DEFAULT
108169689Skan#define PROCESSOR_DEFAULT PROCESSOR_PPC604
109169689Skan
110169689Skan/* Nor sdata, for kernel mode.  We use this in
111169689Skan   SUBSUBTARGET_INITIALIZE_OPTIONS, after rs6000_rtp has been initialized.  */
112169689Skan#undef SDATA_DEFAULT_SIZE
113169689Skan#define SDATA_DEFAULT_SIZE (TARGET_VXWORKS_RTP ? 8 : 0)
114169689Skan
115169689Skan#undef  STACK_BOUNDARY
116169689Skan#define STACK_BOUNDARY (16*BITS_PER_UNIT)
117169689Skan/* Override sysv4.h, reset to the default.  */
118169689Skan#undef  PREFERRED_STACK_BOUNDARY
119169689Skan
120169689Skan/* Enable SPE */
121169689Skan#undef TARGET_SPE_ABI
122169689Skan#undef TARGET_SPE
123169689Skan#undef TARGET_E500
124169689Skan#undef TARGET_ISEL
125169689Skan#undef TARGET_FPRS
126169689Skan
127169689Skan#define TARGET_SPE_ABI rs6000_spe_abi
128169689Skan#define TARGET_SPE rs6000_spe
129169689Skan#define TARGET_E500 (rs6000_cpu == PROCESSOR_PPC8540)
130169689Skan#define TARGET_ISEL rs6000_isel
131169689Skan#define TARGET_FPRS (!rs6000_float_gprs)
132169689Skan
133169689Skan/* Make -mcpu=8540 imply SPE.  ISEL is automatically enabled, the
134169689Skan   others must be done by hand.  Handle -mrtp.  Disable -fPIC
135169689Skan   for -mrtp - the VxWorks PIC model is not compatible with it.  */
136169689Skan#undef SUBSUBTARGET_OVERRIDE_OPTIONS
137169689Skan#define SUBSUBTARGET_OVERRIDE_OPTIONS		\
138169689Skan  do {						\
139169689Skan    if (TARGET_E500)				\
140169689Skan      {						\
141169689Skan	rs6000_spe = 1;				\
142169689Skan	rs6000_spe_abi = 1;			\
143169689Skan	rs6000_float_gprs = 1;			\
144169689Skan      }						\
145169689Skan						\
146169689Skan  if (!g_switch_set)				\
147169689Skan    g_switch_value = SDATA_DEFAULT_SIZE;	\
148169689Skan  VXWORKS_OVERRIDE_OPTIONS;			\
149169689Skan  } while (0)
150169689Skan
151169689Skan/* No _mcount profiling on VxWorks.  */
152169689Skan#undef FUNCTION_PROFILER
153169689Skan#define FUNCTION_PROFILER(FILE,LABELNO) VXWORKS_FUNCTION_PROFILER(FILE,LABELNO)
154