1 /* Definitions of target machine for GCC,
2    for ARM with targeting the VXWorks run time environment.
3    Copyright (C) 1999-2020 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 ("_VX_CPU=XSCALE");		\
47     if (arm_arch8)					\
48       builtin_define ("_VX_CPU=ARMARCH8A");		\
49     else if (arm_arch7)					\
50       {							\
51 	if (!arm_arch_notm)				\
52 	  builtin_define ("_VX_CPU=ARMARCH7M");		\
53 	else if (TARGET_THUMB)				\
54 	  builtin_define ("_VX_CPU=ARMARCH7_T2");	\
55 	else						\
56 	  builtin_define ("_VX_CPU=ARMARCH7");		\
57       }							\
58     else if (arm_arch6)					\
59       {							\
60 	if (TARGET_THUMB)				\
61 	  builtin_define ("_VX_CPU=ARMARCH6_T");	\
62 	else						\
63 	  builtin_define ("_VX_CPU=ARMARCH6");		\
64       }							\
65     else if (arm_arch5t)				\
66 	builtin_define ("_VX_CPU=ARMARCH5_T");		\
67     else if (arm_arch4)					\
68       {							\
69 	if (TARGET_THUMB)				\
70 	  builtin_define ("_VX_CPU=ARMARCH4_T");	\
71 	else						\
72 	  builtin_define ("_VX_CPU=ARMARCH4");		\
73       }							\
74     VXWORKS_OS_CPP_BUILTINS ();				\
75     MAYBE_TARGET_BPABI_CPP_BUILTINS ();			\
76   } while (0)
77 
78 #undef SUBTARGET_OVERRIDE_OPTIONS
79 #define SUBTARGET_OVERRIDE_OPTIONS VXWORKS_OVERRIDE_OPTIONS
80 
81 /* Subsume the arm/elf.h definition, and add RTP hooks.  */
82 #undef SUBTARGET_CPP_SPEC
83 #define SUBTARGET_CPP_SPEC "-D__ELF__" VXWORKS_ADDITIONAL_CPP_SPEC
84 
85 /* .text.hot and .text.unlikely sections are badly handled by the
86    VxWorks kernel mode loader for ARM style exceptions.  */
87 #undef  CC1_SPEC
88 #define CC1_SPEC VXWORKS_CC1_SPEC " %{!mrtp:-fno-reorder-functions}"
89 
90 /* Translate an explicit -mbig-endian as an explicit -EB to assembler
91    and linker, and pass abi options matching the target expectations
92    or command-line requests.  */
93 #define VXWORKS_ENDIAN_SPEC "%{mbig-endian:-EB}"
94 
95 #if defined (TARGET_BPABI_CPP_BUILTINS)
96 #define MAYBE_ASM_ABI_SPEC \
97   "%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=5}" TARGET_FIX_V4BX_SPEC
98 #else
99 #define MAYBE_ASM_ABI_SPEC
100 #endif
101 
102 #undef SUBTARGET_EXTRA_ASM_SPEC
103 #define SUBTARGET_EXTRA_ASM_SPEC MAYBE_ASM_ABI_SPEC " " VXWORKS_ENDIAN_SPEC
104 
105 #undef LINK_SPEC
106 #define LINK_SPEC VXWORKS_LINK_SPEC " " VXWORKS_ENDIAN_SPEC
107 
108 #undef LIB_SPEC
109 #define LIB_SPEC VXWORKS_LIB_SPEC
110 
111 #undef STARTFILE_SPEC
112 #define STARTFILE_SPEC VXWORKS_STARTFILE_SPEC
113 
114 #undef ENDFILE_SPEC
115 #define ENDFILE_SPEC VXWORKS_ENDFILE_SPEC
116 
117 /* There is no default multilib.  */
118 #undef MULTILIB_DEFAULTS
119 
120 #undef FUNCTION_PROFILER
121 #define FUNCTION_PROFILER VXWORKS_FUNCTION_PROFILER
122 
123 /* We want to be compatible with a version of "2.96" at one point in
124    the past before this macro was changed.  */
125 #undef DEFAULT_STRUCTURE_SIZE_BOUNDARY
126 #define DEFAULT_STRUCTURE_SIZE_BOUNDARY 8
127 
128 /* The kernel loader does not allow relocations to overflow, so we
129    cannot allow arbitrary relocation addends in kernel modules or RTP
130    executables.  Also, the dynamic loader uses the resolved relocation
131    value to distinguish references to the text and data segments, so we
132    cannot allow arbitrary offsets for shared libraries either.  */
133 #undef ARM_OFFSETS_MUST_BE_WITHIN_SECTIONS_P
134 #define ARM_OFFSETS_MUST_BE_WITHIN_SECTIONS_P 1
135 
136 #undef TARGET_DEFAULT_WORD_RELOCATIONS
137 #define TARGET_DEFAULT_WORD_RELOCATIONS 1
138 
139 /* Define this to be nonzero if static stack checking is supported.  */
140 #define STACK_CHECK_STATIC_BUILTIN 1
141 
142 /* This platform supports the probing method of stack checking (RTP mode).
143    8K is reserved in the stack to propagate exceptions in case of overflow.  */
144 #define STACK_CHECK_PROTECT 8192
145 
146 /* Unless overridded by the target options, the default is little-endian.  */
147 #define TARGET_ENDIAN_DEFAULT 0
148 
149 /* The VxWorks environment on ARM is llvm based and we need to link
150    against libllvm.a to resolve __aeabi_memcpy4.  */
151 
152 #undef VXWORKS_PERSONALITY
153 #define VXWORKS_PERSONALITY "llvm"
154 
155 #undef VXWORKS_EXTRA_LIBS_RTP
156 #define VXWORKS_EXTRA_LIBS_RTP "-lllvm"
157