Mercurial > hg > CbC > CbC_gcc
comparison gcc/config/rs6000/rtems.h @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | a06113de4d67 |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 /* Definitions for rtems targeting a PowerPC using elf. | 1 /* Definitions for rtems targeting a PowerPC using elf. |
2 Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2007 | 2 Copyright (C) 1996-2017 Free Software Foundation, Inc. |
3 Free Software Foundation, Inc. | |
4 Contributed by Joel Sherrill (joel@OARcorp.com). | 3 Contributed by Joel Sherrill (joel@OARcorp.com). |
5 | 4 |
6 This file is part of GCC. | 5 This file is part of GCC. |
7 | 6 |
8 GCC is free software; you can redistribute it and/or modify it | 7 GCC is free software; you can redistribute it and/or modify it |
13 GCC is distributed in the hope that it will be useful, but WITHOUT | 12 GCC is distributed in the hope that it will be useful, but WITHOUT |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | 13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
15 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | 14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
16 License for more details. | 15 License for more details. |
17 | 16 |
18 You should have received a copy of the GNU General Public License | 17 Under Section 7 of GPL version 3, you are granted additional |
19 along with GCC; see the file COPYING3. If not see | 18 permissions described in the GCC Runtime Library Exception, version |
19 3.1, as published by the Free Software Foundation. | |
20 | |
21 You should have received a copy of the GNU General Public License and | |
22 a copy of the GCC Runtime Library Exception along with this program; | |
23 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
20 <http://www.gnu.org/licenses/>. */ | 24 <http://www.gnu.org/licenses/>. */ |
21 | 25 |
22 /* Specify predefined symbols in preprocessor. */ | 26 /* Copy and paste from linux64.h and freebsd64.h */ |
27 #ifdef IN_LIBGCC2 | |
28 #undef TARGET_64BIT | |
29 #ifdef __powerpc64__ | |
30 #define TARGET_64BIT 1 | |
31 #else | |
32 #define TARGET_64BIT 0 | |
33 #endif | |
34 #endif | |
35 | |
36 /* Copy and paste from linux64.h and freebsd64.h */ | |
37 #undef TARGET_AIX | |
38 #define TARGET_AIX TARGET_64BIT | |
39 | |
40 /* Simplified copy and paste from linux64.h and freebsd64.h */ | |
41 #undef DOT_SYMBOLS | |
42 #define DOT_SYMBOLS 0 | |
43 | |
44 /* Copy and paste from linux64.h and freebsd64.h */ | |
45 #undef TARGET_CMODEL | |
46 #define TARGET_CMODEL rs6000_current_cmodel | |
47 #define SET_CMODEL(opt) rs6000_current_cmodel = opt | |
23 | 48 |
24 #undef TARGET_OS_CPP_BUILTINS | 49 #undef TARGET_OS_CPP_BUILTINS |
25 #define TARGET_OS_CPP_BUILTINS() \ | 50 #define TARGET_OS_CPP_BUILTINS() \ |
26 do \ | 51 do \ |
27 { \ | 52 { \ |
28 builtin_define_std ("PPC"); \ | 53 builtin_define ("__rtems__"); \ |
29 builtin_define ("__rtems__"); \ | 54 builtin_define ("__USE_INIT_FINI__"); \ |
30 builtin_define ("__USE_INIT_FINI__"); \ | 55 builtin_assert ("system=rtems"); \ |
31 builtin_assert ("system=rtems"); \ | 56 if (TARGET_64BIT) \ |
32 builtin_assert ("cpu=powerpc"); \ | 57 { \ |
33 builtin_assert ("machine=powerpc"); \ | 58 builtin_define ("__PPC__"); \ |
34 TARGET_OS_SYSV_CPP_BUILTINS (); \ | 59 builtin_define ("__PPC64__"); \ |
35 } \ | 60 builtin_define ("__powerpc64__"); \ |
61 builtin_assert ("cpu=powerpc64"); \ | |
62 builtin_assert ("machine=powerpc64"); \ | |
63 } \ | |
64 else \ | |
65 { \ | |
66 builtin_define_std ("PPC"); \ | |
67 builtin_define_std ("powerpc"); \ | |
68 builtin_assert ("cpu=powerpc"); \ | |
69 builtin_assert ("machine=powerpc"); \ | |
70 TARGET_OS_SYSV_CPP_BUILTINS (); \ | |
71 } \ | |
72 } \ | |
36 while (0) | 73 while (0) |
37 | 74 |
75 /* Copy and paste from linux64.h and freebsd64.h */ | |
76 #undef RELOCATABLE_NEEDS_FIXUP | |
77 #define RELOCATABLE_NEEDS_FIXUP \ | |
78 (rs6000_isa_flags & rs6000_isa_flags_explicit & OPTION_MASK_RELOCATABLE) | |
79 | |
80 /* Copy and paste from linux64.h */ | |
81 #undef RS6000_ABI_NAME | |
82 #define RS6000_ABI_NAME "linux" | |
83 | |
84 /* Copy and paste from linux64.h and freebsd64.h */ | |
85 #define INVALID_64BIT "-m%s not supported in this configuration" | |
86 | |
87 /* A lot of copy and paste from linux64.h and freebsd64.h */ | |
88 #undef SUBSUBTARGET_OVERRIDE_OPTIONS | |
89 #define SUBSUBTARGET_OVERRIDE_OPTIONS \ | |
90 do \ | |
91 { \ | |
92 if (rs6000_isa_flags & OPTION_MASK_64BIT) \ | |
93 { \ | |
94 rs6000_elf_abi = 2; \ | |
95 rs6000_current_abi = ABI_ELFv2; \ | |
96 if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE) \ | |
97 { \ | |
98 rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \ | |
99 error (INVALID_64BIT, "relocatable"); \ | |
100 } \ | |
101 if (rs6000_isa_flags & OPTION_MASK_EABI) \ | |
102 { \ | |
103 rs6000_isa_flags &= ~OPTION_MASK_EABI; \ | |
104 error (INVALID_64BIT, "eabi"); \ | |
105 } \ | |
106 if (TARGET_PROTOTYPE) \ | |
107 { \ | |
108 target_prototype = 0; \ | |
109 error (INVALID_64BIT, "prototype"); \ | |
110 } \ | |
111 if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) == 0) \ | |
112 { \ | |
113 rs6000_isa_flags |= OPTION_MASK_POWERPC64; \ | |
114 error ("-m64 requires a PowerPC64 cpu"); \ | |
115 } \ | |
116 if ((rs6000_isa_flags_explicit \ | |
117 & OPTION_MASK_MINIMAL_TOC) != 0) \ | |
118 { \ | |
119 if (global_options_set.x_rs6000_current_cmodel \ | |
120 && rs6000_current_cmodel != CMODEL_SMALL) \ | |
121 error ("-mcmodel incompatible with other toc options"); \ | |
122 SET_CMODEL (CMODEL_SMALL); \ | |
123 } \ | |
124 else \ | |
125 { \ | |
126 if (!global_options_set.x_rs6000_current_cmodel) \ | |
127 SET_CMODEL (CMODEL_MEDIUM); \ | |
128 if (rs6000_current_cmodel != CMODEL_SMALL) \ | |
129 { \ | |
130 TARGET_NO_FP_IN_TOC = 0; \ | |
131 TARGET_NO_SUM_IN_TOC = 0; \ | |
132 } \ | |
133 } \ | |
134 } \ | |
135 } \ | |
136 while (0) | |
137 | |
138 #undef TARGET_LIBGCC_SDATA_SECTION | |
139 #define TARGET_LIBGCC_SDATA_SECTION ".sdata" | |
140 | |
141 /* Copy and paste from linux64.h and freebsd64.h */ | |
142 #undef SIZE_TYPE | |
143 #define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int") | |
144 | |
145 /* Copy and paste from linux64.h and freebsd64.h */ | |
146 #undef PTRDIFF_TYPE | |
147 #define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int") | |
148 | |
149 /* Copy and paste from freebsd64.h */ | |
150 #undef WCHAR_TYPE | |
151 | |
152 /* Copy and paste from freebsd64.h */ | |
153 #undef WCHAR_TYPE_SIZE | |
154 #define WCHAR_TYPE_SIZE 32 | |
155 | |
156 /* Copy and paste from linux64.h and freebsd64.h */ | |
157 #ifdef __powerpc64__ | |
158 #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ | |
159 asm (SECTION_OP "\n" \ | |
160 " bl " #FUNC "\n" \ | |
161 " nop\n" \ | |
162 " .previous"); | |
163 #endif | |
164 | |
165 /* This could be also POWERPC_FREEBSD. It is related to the save/restore | |
166 defines below. */ | |
167 #define POWERPC_LINUX | |
168 | |
169 /* Copy and paste from linux64.h and freebsd64.h */ | |
170 #undef SAVE_FP_PREFIX | |
171 #define SAVE_FP_PREFIX (TARGET_64BIT ? "._savef" : "_savefpr_") | |
172 #undef SAVE_FP_SUFFIX | |
173 #define SAVE_FP_SUFFIX "" | |
174 #undef RESTORE_FP_PREFIX | |
175 #define RESTORE_FP_PREFIX (TARGET_64BIT ? "._restf" : "_restfpr_") | |
176 #undef RESTORE_FP_SUFFIX | |
177 #define RESTORE_FP_SUFFIX "" | |
178 | |
179 /* Copy and paste from linux64.h and freebsd64.h */ | |
180 #undef ASM_PREFERRED_EH_DATA_FORMAT | |
181 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \ | |
182 (TARGET_64BIT || flag_pic \ | |
183 ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel \ | |
184 | (TARGET_64BIT ? DW_EH_PE_udata8 : DW_EH_PE_sdata4)) \ | |
185 : DW_EH_PE_absptr) | |
186 | |
187 /* Copy and paste from linux64.h and freebsd64.h */ | |
188 #undef TOC_SECTION_ASM_OP | |
189 #define TOC_SECTION_ASM_OP \ | |
190 (TARGET_64BIT \ | |
191 ? "\t.section\t\".toc\",\"aw\"" \ | |
192 : "\t.section\t\".got\",\"aw\"") | |
193 | |
194 /* Copy and paste from linux64.h and freebsd64.h */ | |
195 #undef MINIMAL_TOC_SECTION_ASM_OP | |
196 #define MINIMAL_TOC_SECTION_ASM_OP \ | |
197 (TARGET_64BIT \ | |
198 ? "\t.section\t\".toc1\",\"aw\"" \ | |
199 : (flag_pic \ | |
200 ? "\t.section\t\".got2\",\"aw\"" \ | |
201 : "\t.section\t\".got1\",\"aw\"")) | |
202 | |
203 /* Copy and paste from linux64.h and freebsd64.h */ | |
204 #undef ASM_DECLARE_FUNCTION_SIZE | |
205 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ | |
206 do \ | |
207 { \ | |
208 if (!flag_inhibit_size_directive) \ | |
209 { \ | |
210 fputs ("\t.size\t", (FILE)); \ | |
211 if (TARGET_64BIT && DOT_SYMBOLS) \ | |
212 putc ('.', (FILE)); \ | |
213 assemble_name ((FILE), (FNAME)); \ | |
214 fputs (",.-", (FILE)); \ | |
215 rs6000_output_function_entry (FILE, FNAME); \ | |
216 putc ('\n', (FILE)); \ | |
217 } \ | |
218 } \ | |
219 while (0) | |
220 | |
221 /* Copy and paste from linux64.h and freebsd64.h */ | |
222 #undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P | |
223 #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \ | |
224 (TARGET_TOC \ | |
225 && (GET_CODE (X) == SYMBOL_REF \ | |
226 || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \ | |
227 && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \ | |
228 || GET_CODE (X) == LABEL_REF \ | |
229 || (GET_CODE (X) == CONST_INT \ | |
230 && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \ | |
231 || (GET_CODE (X) == CONST_DOUBLE \ | |
232 && ((TARGET_64BIT \ | |
233 && (TARGET_MINIMAL_TOC \ | |
234 || (SCALAR_FLOAT_MODE_P (GET_MODE (X)) \ | |
235 && ! TARGET_NO_FP_IN_TOC))) \ | |
236 || (!TARGET_64BIT \ | |
237 && !TARGET_NO_FP_IN_TOC \ | |
238 && SCALAR_FLOAT_MODE_P (GET_MODE (X)) \ | |
239 && BITS_PER_WORD == HOST_BITS_PER_INT))))) | |
240 | |
38 #undef CPP_OS_DEFAULT_SPEC | 241 #undef CPP_OS_DEFAULT_SPEC |
39 #define CPP_OS_DEFAULT_SPEC "%(cpp_os_rtems)" | 242 #define CPP_OS_DEFAULT_SPEC "\ |
40 | |
41 #define CPP_OS_RTEMS_SPEC "\ | |
42 %{!mcpu*: %{!Dppc*: %{!Dmpc*: -Dmpc750} } }\ | 243 %{!mcpu*: %{!Dppc*: %{!Dmpc*: -Dmpc750} } }\ |
43 %{mcpu=403: %{!Dppc*: %{!Dmpc*: -Dppc403} } } \ | 244 %{mcpu=403: %{!Dppc*: %{!Dmpc*: -Dppc403} } } \ |
44 %{mcpu=505: %{!Dppc*: %{!Dmpc*: -Dmpc505} } } \ | 245 %{mcpu=505: %{!Dppc*: %{!Dmpc*: -Dmpc505} } } \ |
45 %{mcpu=601: %{!Dppc*: %{!Dmpc*: -Dppc601} } } \ | 246 %{mcpu=601: %{!Dppc*: %{!Dmpc*: -Dppc601} } } \ |
46 %{mcpu=602: %{!Dppc*: %{!Dmpc*: -Dppc602} } } \ | 247 %{mcpu=602: %{!Dppc*: %{!Dmpc*: -Dppc602} } } \ |
47 %{mcpu=603: %{!Dppc*: %{!Dmpc*: -Dppc603} } } \ | 248 %{mcpu=603: %{!Dppc*: %{!Dmpc*: -Dppc603} } } \ |
48 %{mcpu=603e: %{!Dppc*: %{!Dmpc*: -Dppc603e} } } \ | 249 %{mcpu=603e: %{!Dppc*: %{!Dmpc*: -Dppc603e} } } \ |
49 %{mcpu=604: %{!Dppc*: %{!Dmpc*: -Dmpc604} } } \ | 250 %{mcpu=604: %{!Dppc*: %{!Dmpc*: -Dmpc604} } } \ |
50 %{mcpu=750: %{!Dppc*: %{!Dmpc*: -Dmpc750} } } \ | 251 %{mcpu=750: %{!Dppc*: %{!Dmpc*: -Dmpc750} } } \ |
51 %{mcpu=821: %{!Dppc*: %{!Dmpc*: -Dmpc821} } } \ | 252 %{mcpu=821: %{!Dppc*: %{!Dmpc*: -Dmpc821} } } \ |
52 %{mcpu=860: %{!Dppc*: %{!Dmpc*: -Dmpc860} } }" | 253 %{mcpu=860: %{!Dppc*: %{!Dmpc*: -Dmpc860} } } \ |
254 %{mcpu=8540: %{!Dppc*: %{!Dmpc*: -Dppc8540} } } \ | |
255 %{mcpu=e6500: -D__PPC_CPU_E6500__}" | |
256 | |
257 #undef ASM_DEFAULT_SPEC | |
258 #define ASM_DEFAULT_SPEC "-mppc%{m64:64}" | |
259 | |
260 #undef ASM_SPEC | |
261 #define ASM_SPEC "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)" | |
262 | |
263 #define ASM_SPEC32 "-a32 \ | |
264 %{mrelocatable} %{mrelocatable-lib} %{" FPIE_OR_FPIC_SPEC ":-K PIC} \ | |
265 %{memb|msdata=eabi: -memb}" | |
266 | |
267 #define ASM_SPEC64 "-a64" | |
268 | |
269 #define ASM_SPEC_COMMON "%(asm_cpu) \ | |
270 %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}}" \ | |
271 ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN) | |
272 | |
273 #undef LINK_OS_DEFAULT_SPEC | |
274 #define LINK_OS_DEFAULT_SPEC \ | |
275 "%{!m64:%(link_os_spec32)}%{m64:%(link_os_spec64)}" | |
276 | |
277 #define LINK_OS_SPEC32 ENDIAN_SELECT(" -m elf32ppc", \ | |
278 " -m elf32lppc", \ | |
279 " -m elf32ppc") | |
280 #define LINK_OS_SPEC64 ENDIAN_SELECT(" -m elf64ppc", \ | |
281 " -m elf64lppc", \ | |
282 " -m elf64ppc") | |
53 | 283 |
54 #undef SUBSUBTARGET_EXTRA_SPECS | 284 #undef SUBSUBTARGET_EXTRA_SPECS |
55 #define SUBSUBTARGET_EXTRA_SPECS \ | 285 #define SUBSUBTARGET_EXTRA_SPECS \ |
56 { "cpp_os_rtems", CPP_OS_RTEMS_SPEC } | 286 { "asm_spec_common", ASM_SPEC_COMMON }, \ |
287 { "asm_spec32", ASM_SPEC32 }, \ | |
288 { "asm_spec64", ASM_SPEC64 }, \ | |
289 { "link_os_spec32", LINK_OS_SPEC32 }, \ | |
290 { "link_os_spec64", LINK_OS_SPEC64 }, |