xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/config/rs6000/vxworks.h (revision aef5eb5f59cdfe8314f1b5f78ac04eb144e44010)
1 /* Definitions of target machine for GNU compiler.  Vxworks PowerPC version.
2    Copyright (C) 1996-2019 Free Software Foundation, Inc.
3    Contributed by CodeSourcery, LLC.
4 
5 This file is part of GCC.
6 
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
11 
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3.  If not see
19 <http://www.gnu.org/licenses/>.  */
20 
21 /* Note to future editors: VxWorks is mostly an EABI target.  We do
22    not use rs6000/eabi.h because we would have to override most of
23    it anyway.  However, if you change that file, consider making
24    analogous changes here too.  */
25 
26 /* CPP predefined macros.  */
27 
28 #undef TARGET_OS_CPP_BUILTINS
29 #define TARGET_OS_CPP_BUILTINS()		\
30   do						\
31     {						\
32       builtin_define ("__ppc");			\
33       builtin_define ("__PPC__");		\
34       builtin_define ("__EABI__");		\
35       builtin_define ("__ELF__");		\
36       if (!TARGET_SOFT_FLOAT)			\
37 	builtin_define ("__hardfp");		\
38 						\
39       /* C89 namespace violation! */		\
40       builtin_define ("CPU_FAMILY=PPC");	\
41         					\
42       VXWORKS_OS_CPP_BUILTINS ();		\
43     }		\
44   while (0)
45 
46 /* Only big endian PPC is supported by VxWorks.  */
47 #undef BYTES_BIG_ENDIAN
48 #define BYTES_BIG_ENDIAN 1
49 #undef WORDS_BIG_ENDIAN
50 #define WORDS_BIG_ENDIAN 1
51 
52 /* We have to kill off the entire specs set created by rs6000/sysv4.h
53    and substitute our own set.  The top level vxworks.h has done some
54    of this for us.  */
55 
56 #undef SUBTARGET_EXTRA_SPECS
57 #undef CPP_SPEC
58 #undef CC1_SPEC
59 #undef ASM_SPEC
60 
61 #define SUBTARGET_EXTRA_SPECS /* none needed */
62 
63 /* FIXME: The only reason we allow no -mcpu switch at all is because
64    config-ml.in insists on a "." multilib. */
65 #define CPP_SPEC \
66 "%{!DCPU=*:		  \
67    %{mcpu=403 : -DCPU=PPC403  ; \
68      mcpu=405 : -DCPU=PPC405  ; \
69      mcpu=440 : -DCPU=PPC440  ; \
70      mcpu=464 : -DCPU=PPC464  ; \
71      mcpu=476 : -DCPU=PPC476  ; \
72      mcpu=603 : -DCPU=PPC603  ; \
73      mcpu=604 : -DCPU=PPC604  ; \
74      mcpu=860 : -DCPU=PPC860  ; \
75      mcpu=8540: -DCPU=PPC85XX ; \
76      mcpu=8548: -DCPU=PPC85XX ; \
77               : -DCPU=PPC604  }}" \
78 VXWORKS_ADDITIONAL_CPP_SPEC
79 
80 #define CC1_SPEC						\
81 "%{G*} %{mno-sdata:-msdata=none} %{msdata:-msdata=default}	\
82  %{mlittle|mlittle-endian:-mstrict-align}"
83 
84 #define ASM_SPEC \
85 "%(asm_cpu) \
86  %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \
87  %{mrelocatable} %{mrelocatable-lib} %{" FPIC_SPEC ":-K PIC} -mbig"
88 
89 #undef  LIB_SPEC
90 #define LIB_SPEC VXWORKS_LIB_SPEC
91 
92 /* For RTPs, leverage linker relaxation.  This helps programs referring
93    to, typically, kernel services too far away for short calls.  This is more
94    precise than -mlongcall and can be overriden with -Wl,--no-relax.  */
95 #define VXWORKS_RELAX_LINK_SPEC "%{mrtp:--relax}"
96 
97 #undef  LINK_SPEC
98 #define LINK_SPEC VXWORKS_LINK_SPEC " " VXWORKS_RELAX_LINK_SPEC
99 
100 #undef  STARTFILE_SPEC
101 #define STARTFILE_SPEC VXWORKS_STARTFILE_SPEC
102 #undef  ENDFILE_SPEC
103 #define ENDFILE_SPEC VXWORKS_ENDFILE_SPEC
104 
105 /* There is no default multilib.  */
106 #undef MULTILIB_DEFAULTS
107 
108 #undef TARGET_DEFAULT
109 #define TARGET_DEFAULT (MASK_EABI | MASK_STRICT_ALIGN)
110 
111 #undef PROCESSOR_DEFAULT
112 #define PROCESSOR_DEFAULT PROCESSOR_PPC604
113 
114 /* Nor sdata, for kernel mode.  We use this in
115    SUBSUBTARGET_INITIALIZE_OPTIONS, after rs6000_rtp has been initialized.  */
116 #undef SDATA_DEFAULT_SIZE
117 #define SDATA_DEFAULT_SIZE (TARGET_VXWORKS_RTP ? 8 : 0)
118 
119 /* Enforce 16-byte alignment for the stack pointer, to permit general
120    compliance with e.g. Altivec instructions requirements.  Make sure
121    this isn't overruled by the EABI constraints.  */
122 
123 #undef  STACK_BOUNDARY
124 #define STACK_BOUNDARY (16*BITS_PER_UNIT)
125 
126 #undef  PREFERRED_STACK_BOUNDARY
127 #define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY
128 
129 #undef  ABI_STACK_BOUNDARY
130 
131 #undef RS6000_STARTING_FRAME_OFFSET
132 #define RS6000_STARTING_FRAME_OFFSET					\
133   (cfun->calls_alloca							\
134    ? RS6000_ALIGN (crtl->outgoing_args_size + RS6000_SAVE_AREA, 16)	\
135    : (RS6000_ALIGN (crtl->outgoing_args_size, 16) + RS6000_SAVE_AREA))
136 
137 #undef STACK_DYNAMIC_OFFSET
138 #define STACK_DYNAMIC_OFFSET(FUNDECL)					\
139    RS6000_ALIGN (crtl->outgoing_args_size.to_constant ()		\
140 		 + STACK_POINTER_OFFSET, 16)
141 
142 #undef SUBSUBTARGET_OVERRIDE_OPTIONS
143 #define SUBSUBTARGET_OVERRIDE_OPTIONS		\
144   do {						\
145   if (!global_options_set.x_g_switch_value)	\
146     g_switch_value = SDATA_DEFAULT_SIZE;	\
147   VXWORKS_OVERRIDE_OPTIONS;			\
148   } while (0)
149 
150 /* No _mcount profiling on VxWorks.  */
151 #undef FUNCTION_PROFILER
152 #define FUNCTION_PROFILER(FILE,LABELNO) VXWORKS_FUNCTION_PROFILER(FILE,LABELNO)
153 
154 /* Define this to be nonzero if static stack checking is supported.  */
155 #define STACK_CHECK_STATIC_BUILTIN 1
156 
157 /* This platform supports the probing method of stack checking (RTP mode).
158    8K is reserved in the stack to propagate exceptions in case of overflow.  */
159 #define STACK_CHECK_PROTECT 8192
160