1 /* IA32 VxWorks target definitions for GNU compiler.
2    Copyright (C) 2003-2021 Free Software Foundation, Inc.
3    Updated by CodeSourcery, LLC.
4 
5 This file is part of GCC.
6 
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
11 
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License 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 /* VxWorks after 7 SR0600 use the ELF ABI and the system environment is llvm
22    based.  Earlier versions have GNU based environment components and use the
23    same ABI as Solaris 2.  */
24 
25 #if TARGET_VXWORKS7
26 
27 #undef VXWORKS_PERSONALITY
28 #define VXWORKS_PERSONALITY "llvm"
29 
30 #else
31 
32 #undef ASM_OUTPUT_ALIGNED_BSS
33 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
34   asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
35 
36 #undef TARGET_SUBTARGET_DEFAULT
37 #define TARGET_SUBTARGET_DEFAULT \
38 	(MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_VECT8_RETURNS)
39 
40 /* Provide our target specific DBX_REGISTER_NUMBER.  VxWorks relies on
41    the SVR4 numbering.  */
42 
43 #undef DBX_REGISTER_NUMBER
44 #define DBX_REGISTER_NUMBER(n) \
45   (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
46 
47 #undef PTRDIFF_TYPE
48 #define PTRDIFF_TYPE (TARGET_LP64 ? "long int" : "int")
49 
50 #undef SIZE_TYPE
51 #define SIZE_TYPE (TARGET_LP64 ? "long unsigned int" : "unsigned int")
52 
53 /* We cannot use PC-relative accesses for VxWorks PIC because there is no
54    fixed gap between segments.  */
55 #undef ASM_PREFERRED_EH_DATA_FORMAT
56 
57 #if TARGET_64BIT_DEFAULT
58 #undef VXWORKS_SYSCALL_LIBS_RTP
59 #define VXWORKS_SYSCALL_LIBS_RTP "-lsyscall"
60 #endif
61 
62 #endif
63 
64 /* CPU macro definitions, ordered to account for VxWorks 7 not
65    supporting CPUs older than PENTIUM4 since SR0650.  */
66 
67 #define VX_CPUDEF(CPU) builtin_define(VX_CPU_PREFIX "CPU=" #CPU)
68 #define VX_CPUVDEF(CPU) builtin_define(VX_CPU_PREFIX "CPU_VARIANT=" #CPU)
69 
70 #define TARGET_OS_CPP_BUILTINS()			\
71   do							\
72     {							\
73       VXWORKS_OS_CPP_BUILTINS ();			\
74       if (TARGET_64BIT)					\
75 	VX_CPUDEF (X86_64);				\
76       else if (TARGET_PENTIUM4)				\
77 	{						\
78 	  VX_CPUDEF (PENTIUM4);				\
79 	  VX_CPUVDEF (PENTIUM4);			\
80 	}						\
81       else if (TARGET_CORE2)				\
82 	VX_CPUDEF (CORE2);				\
83       else if (TARGET_NEHALEM)				\
84 	VX_CPUDEF (NEHALEM);				\
85       else if (TARGET_SANDYBRIDGE)			\
86 	VX_CPUDEF (SANDYBRIDGE);			\
87       else if (TARGET_HASWELL)				\
88 	VX_CPUDEF (HASWELL);				\
89       else if (TARGET_SILVERMONT)			\
90 	VX_CPUDEF (SILVERMONT);				\
91       else if (TARGET_SKYLAKE || TARGET_SKYLAKE_AVX512) \
92 	VX_CPUDEF (SKYLAKE);				\
93       else if (TARGET_GOLDMONT)				\
94 	VX_CPUDEF (GOLDMONT);				\
95       else if (TARGET_VXWORKS7)				\
96 	VX_CPUDEF (PENTIUM4);				\
97       else if (TARGET_386)				\
98 	VX_CPUDEF (I80386);				\
99       else if (TARGET_486)				\
100 	VX_CPUDEF (I80486);				\
101       else if (TARGET_PENTIUM)				\
102 	{						\
103 	  VX_CPUDEF (PENTIUM);				\
104 	  VX_CPUVDEF (PENTIUM);				\
105 	}						\
106       else if (TARGET_PENTIUMPRO)			\
107 	{						\
108 	  VX_CPUDEF (PENTIUM2);				\
109 	  VX_CPUVDEF (PENTIUMPRO);			\
110 	}						\
111       else						\
112 	VX_CPUDEF (I80386);				\
113     }							\
114   while (0)
115 
116 #undef  CPP_SPEC
117 #define CPP_SPEC VXWORKS_ADDITIONAL_CPP_SPEC
118 #undef  CC1_SPEC
119 #define CC1_SPEC VXWORKS_CC1_SPEC
120 #undef  LIB_SPEC
121 #define LIB_SPEC VXWORKS_LIB_SPEC
122 #undef  STARTFILE_SPEC
123 #define STARTFILE_SPEC VXWORKS_STARTFILE_SPEC
124 #undef  ENDFILE_SPEC
125 #define ENDFILE_SPEC VXWORKS_ENDFILE_SPEC
126 #undef  LINK_SPEC
127 #define LINK_SPEC VXWORKS_LINK_SPEC
128 
129 #undef  SUBTARGET_SWITCHES
130 #define SUBTARGET_SWITCHES EXTRA_SUBTARGET_SWITCHES
131 
132 #undef SUBTARGET_OVERRIDE_OPTIONS
133 #define SUBTARGET_OVERRIDE_OPTIONS VXWORKS_OVERRIDE_OPTIONS
134 
135 /* No _mcount profiling on VxWorks.  */
136 #undef FUNCTION_PROFILER
137 #define FUNCTION_PROFILER(FILE,LABELNO) VXWORKS_FUNCTION_PROFILER(FILE,LABELNO)
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    On 64-bit targets, we double that size.  */
145 
146 #define STACK_CHECK_PROTECT (TARGET_64BIT_DEFAULT ? 16 * 1024 : 8 * 1024)
147