1 /* Definitions of target machine for GCC,
2    for ARM with targeting the VXWorks run time environment.
3    Copyright (C) 1999-2018 Free Software Foundation, Inc.
4 
5    Contributed by: Mike Stump <mrs@wrs.com>
6    Brought up to date by CodeSourcery, LLC.
7 
8 This file is part of GCC.
9 
10 GCC is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3, or (at your option)
13 any later version.
14 
15 GCC is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 GNU General Public License for more details.
19 
20 Under Section 7 of GPL version 3, you are granted additional
21 permissions described in the GCC Runtime Library Exception, version
22 3.1, as published by the Free Software Foundation.
23 
24 You should have received a copy of the GNU General Public License and
25 a copy of the GCC Runtime Library Exception along with this program;
26 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
27 <http://www.gnu.org/licenses/>.  */
28 
29 /* TARGET_OS_CPP_BUILTINS, down to BPABI if defined.  */
30 
31 #if defined (TARGET_BPABI_CPP_BUILTINS)
32 #define MAYBE_TARGET_BPABI_CPP_BUILTINS TARGET_BPABI_CPP_BUILTINS
33 #else
34 #define MAYBE_TARGET_BPABI_CPP_BUILTINS()
35 #endif
36 
37 #undef TARGET_OS_CPP_BUILTINS
38 #define TARGET_OS_CPP_BUILTINS()		\
39   do {						\
40     if (TARGET_BIG_END)				\
41       builtin_define ("ARMEB");			\
42     else					\
43       builtin_define ("ARMEL");			\
44 						\
45     if (arm_arch_xscale)			\
46       builtin_define ("CPU=XSCALE");		\
47     else if (arm_arch7)				\
48       {						\
49 	if (!arm_arch_notm)			\
50 	  builtin_define ("CPU=ARMARCH7M");	\
51 	else if (TARGET_THUMB)			\
52 	  builtin_define ("CPU=ARMARCH7_T2");	\
53 	else					\
54 	  builtin_define ("CPU=ARMARCH7");	\
55       }						\
56     else if (arm_arch6)				\
57       {						\
58 	if (TARGET_THUMB)			\
59 	  builtin_define ("CPU=ARMARCH6_T");	\
60 	else					\
61 	  builtin_define ("CPU=ARMARCH6");	\
62       }						\
63     else if (arm_arch5)				\
64       {						\
65 	if (TARGET_THUMB)			\
66 	  builtin_define ("CPU=ARMARCH5_T");	\
67 	else					\
68 	  builtin_define ("CPU=ARMARCH5");	\
69       }						\
70     else if (arm_arch4)				\
71       {						\
72 	if (TARGET_THUMB)			\
73 	  builtin_define ("CPU=ARMARCH4_T");	\
74 	else					\
75 	  builtin_define ("CPU=ARMARCH4");	\
76       }						\
77     VXWORKS_OS_CPP_BUILTINS ();			\
78     MAYBE_TARGET_BPABI_CPP_BUILTINS ();		\
79   } while (0)
80 
81 #undef SUBTARGET_OVERRIDE_OPTIONS
82 #define SUBTARGET_OVERRIDE_OPTIONS VXWORKS_OVERRIDE_OPTIONS
83 
84 /* Subsume the arm/elf.h definition, and add RTP hooks.  */
85 #undef SUBTARGET_CPP_SPEC
86 #define SUBTARGET_CPP_SPEC "-D__ELF__" VXWORKS_ADDITIONAL_CPP_SPEC
87 
88 /* .text.hot and .text.unlikely sections are badly handled by the
89    VxWorks kernel mode loader for ARM style exceptions.  */
90 
91 #if ARM_UNWIND_INFO
92 #define EXTRA_CC1_SPEC "%{!mrtp:-fno-reorder-functions}"
93 #else
94 #define EXTRA_CC1_SPEC
95 #endif
96 
97 #undef  CC1_SPEC
98 #define CC1_SPEC "" EXTRA_CC1_SPEC
99 
100 /* Translate an explicit -mbig-endian as an explicit -EB to assembler
101    and linker, and pass abi options matching the target expectations
102    or command-line requests.  */
103 #define VXWORKS_ENDIAN_SPEC "%{mbig-endian:-EB}"
104 
105 #if defined (TARGET_BPABI_CPP_BUILTINS)
106 #define MAYBE_ASM_ABI_SPEC \
107   "%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=5}" TARGET_FIX_V4BX_SPEC
108 #else
109 #define MAYBE_ASM_ABI_SPEC
110 #endif
111 
112 #undef SUBTARGET_EXTRA_ASM_SPEC
113 #define SUBTARGET_EXTRA_ASM_SPEC MAYBE_ASM_ABI_SPEC " " VXWORKS_ENDIAN_SPEC
114 
115 #undef LINK_SPEC
116 #define LINK_SPEC VXWORKS_LINK_SPEC " " VXWORKS_ENDIAN_SPEC
117 
118 #undef LIB_SPEC
119 #define LIB_SPEC VXWORKS_LIB_SPEC
120 
121 #undef STARTFILE_SPEC
122 #define STARTFILE_SPEC VXWORKS_STARTFILE_SPEC
123 
124 #undef ENDFILE_SPEC
125 #define ENDFILE_SPEC VXWORKS_ENDFILE_SPEC
126 
127 /* For exceptions, pre VX7 uses DWARF2 info, VX7 uses ARM unwinding.  */
128 #undef  DWARF2_UNWIND_INFO
129 #define DWARF2_UNWIND_INFO (!TARGET_VXWORKS7)
130 
131 #undef ARM_TARGET2_DWARF_FORMAT
132 #define ARM_TARGET2_DWARF_FORMAT \
133   (TARGET_VXWORKS_RTP ? DW_EH_PE_pcrel : DW_EH_PE_absptr)
134 
135 /* There is no default multilib.  */
136 #undef MULTILIB_DEFAULTS
137 
138 #undef FUNCTION_PROFILER
139 #define FUNCTION_PROFILER VXWORKS_FUNCTION_PROFILER
140 
141 /* We want to be compatible with a version of "2.96" at one point in
142    the past before this macro was changed.  */
143 #undef DEFAULT_STRUCTURE_SIZE_BOUNDARY
144 #define DEFAULT_STRUCTURE_SIZE_BOUNDARY 8
145 
146 /* The kernel loader does not allow relocations to overflow, so we
147    cannot allow arbitrary relocation addends in kernel modules or RTP
148    executables.  Also, the dynamic loader uses the resolved relocation
149    value to distinguish references to the text and data segments, so we
150    cannot allow arbitrary offsets for shared libraries either.  */
151 #undef ARM_OFFSETS_MUST_BE_WITHIN_SECTIONS_P
152 #define ARM_OFFSETS_MUST_BE_WITHIN_SECTIONS_P 1
153 
154 #undef TARGET_DEFAULT_WORD_RELOCATIONS
155 #define TARGET_DEFAULT_WORD_RELOCATIONS 1
156 
157 /* Define this to be nonzero if static stack checking is supported.  */
158 #define STACK_CHECK_STATIC_BUILTIN 1
159 
160 /* This platform supports the probing method of stack checking (RTP mode).
161    8K is reserved in the stack to propagate exceptions in case of overflow.  */
162 #define STACK_CHECK_PROTECT 8192
163 
164 /* Unless overridded by the target options, the default is little-endian.  */
165 #define TARGET_ENDIAN_DEFAULT 0
166