Mercurial > hg > CbC > CbC_gcc
annotate gcc/config/i386/darwin.h @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
rev | line source |
---|---|
0 | 1 /* Target definitions for x86 running Darwin. |
145 | 2 Copyright (C) 2001-2020 Free Software Foundation, Inc. |
0 | 3 Contributed by Apple Computer Inc. |
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 /* Enable Mach-O bits in generic x86 code. */ | |
22 #undef TARGET_MACHO | |
23 #define TARGET_MACHO 1 | |
24 | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
25 #undef DARWIN_X86 |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
26 #define DARWIN_X86 1 |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
27 |
145 | 28 #undef TARGET_64BIT |
111 | 29 #define TARGET_64BIT TARGET_ISA_64BIT |
145 | 30 #undef TARGET_64BIT_P |
31 #define TARGET_64BIT_P(x) TARGET_ISA_64BIT_P(x) | |
0 | 32 |
33 #ifdef IN_LIBGCC2 | |
34 #undef TARGET_64BIT | |
35 #ifdef __x86_64__ | |
36 #define TARGET_64BIT 1 | |
37 #else | |
38 #define TARGET_64BIT 0 | |
39 #endif | |
40 #endif | |
41 | |
111 | 42 /* WORKAROUND pr80556: |
43 For x86_64 Darwin10 and later, the unwinder is in libunwind (redirected | |
44 from libSystem). This doesn't use the keymgr (see keymgr.c) and therefore | |
45 the calls that libgcc makes to obtain the KEYMGR_GCC3_DW2_OBJ_LIST are not | |
46 updated to include new images, and might not even be valid for a single | |
47 image. | |
48 Therefore, for 64b exes at least, we must use the libunwind implementation, | |
49 even when static-libgcc is specified. We put libSystem first so that | |
145 | 50 unwinder symbols are satisfied from there. |
51 We default to 64b for single-arch builds, so apply this unconditionally. */ | |
111 | 52 #undef REAL_LIBGCC_SPEC |
53 #define REAL_LIBGCC_SPEC \ | |
54 "%{static-libgcc|static: \ | |
145 | 55 %:version-compare(>= 10.6 mmacosx-version-min= -lSystem) \ |
56 -lgcc_eh -lgcc; \ | |
111 | 57 shared-libgcc|fexceptions|fgnu-runtime: \ |
58 %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_s.10.4) \ | |
59 %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5) \ | |
60 %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_ext.10.4) \ | |
61 %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_ext.10.5) \ | |
62 -lgcc ; \ | |
63 :%:version-compare(>< 10.3.9 10.5 mmacosx-version-min= -lgcc_s.10.4) \ | |
64 %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5) \ | |
65 %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_ext.10.4) \ | |
66 %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_ext.10.5) \ | |
67 -lgcc }" | |
68 | |
0 | 69 /* Size of the Obj-C jump buffer. */ |
70 #define OBJC_JBLEN ((TARGET_64BIT) ? ((9 * 2) + 3 + 16) : (18)) | |
71 | |
72 #undef TARGET_FPMATH_DEFAULT | |
73 #define TARGET_FPMATH_DEFAULT (TARGET_SSE ? FPMATH_SSE : FPMATH_387) | |
145 | 74 #undef TARGET_FPMATH_DEFAULT_P |
75 #define TARGET_FPMATH_DEFAULT_P(x) \ | |
76 (TARGET_SSE_P(x) ? FPMATH_SSE : FPMATH_387) | |
0 | 77 |
78 #define TARGET_OS_CPP_BUILTINS() \ | |
145 | 79 do { \ |
80 builtin_define ("__LITTLE_ENDIAN__"); \ | |
81 darwin_cpp_builtins (pfile); \ | |
82 } while (0) | |
0 | 83 |
84 #undef PTRDIFF_TYPE | |
85 #define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int") | |
86 | |
87 #undef WCHAR_TYPE | |
88 #define WCHAR_TYPE "int" | |
89 | |
90 #undef WCHAR_TYPE_SIZE | |
91 #define WCHAR_TYPE_SIZE 32 | |
92 | |
145 | 93 /* Generate pic symbol indirection stubs if this is true. */ |
94 #undef TARGET_MACHO_SYMBOL_STUBS | |
95 #define TARGET_MACHO_SYMBOL_STUBS (darwin_symbol_stubs) | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
96 |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
97 /* For compatibility with OSX system tools, use the new style of pic stub |
145 | 98 if this is set (default). */ |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
99 #undef MACHOPIC_ATT_STUB |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
100 #define MACHOPIC_ATT_STUB (darwin_macho_att_stub) |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
101 |
0 | 102 #undef MAX_BITS_PER_WORD |
103 #define MAX_BITS_PER_WORD 64 | |
104 | |
105 #undef FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN | |
106 #define FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN (0) | |
107 | |
108 #undef TARGET_KEEPS_VECTOR_ALIGNED_STACK | |
109 #define TARGET_KEEPS_VECTOR_ALIGNED_STACK 1 | |
110 | |
111 /* On Darwin, the stack is 128-bit aligned at the point of every call. | |
112 Failure to ensure this will lead to a crash in the system libraries | |
113 or dynamic loader. */ | |
114 | |
115 #undef MAIN_STACK_BOUNDARY | |
116 #define MAIN_STACK_BOUNDARY 128 | |
117 | |
118 /* Since we'll never want a stack boundary less aligned than 128 bits | |
119 we need the extra work here otherwise bits of gcc get very grumpy | |
120 when we ask for lower alignment. We could just reject values less | |
121 than 128 bits for Darwin, but it's easier to up the alignment if | |
122 it's below the minimum. */ | |
123 #undef PREFERRED_STACK_BOUNDARY | |
145 | 124 #define PREFERRED_STACK_BOUNDARY \ |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
125 MAX (128, ix86_preferred_stack_boundary) |
0 | 126 |
127 /* We want -fPIC by default, unless we're using -static to compile for | |
128 the kernel or some such. */ | |
129 | |
130 #undef CC1_SPEC | |
131 #define CC1_SPEC "%(cc1_cpu) \ | |
132 %{!mkernel:%{!static:%{!mdynamic-no-pic:-fPIC}}} \ | |
145 | 133 %{g: %{!fno-eliminate-unused-debug-symbols: -feliminate-unused-debug-symbols }} \ |
134 %{mx32:%eDarwin is not an mx32 platform} \ | |
135 %{mfentry*:%eDarwin does not support -mfentry or associated options}" \ | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
136 DARWIN_CC1_SPEC |
0 | 137 |
138 #undef ASM_SPEC | |
111 | 139 #define ASM_SPEC "-arch %(darwin_arch) \ |
140 " ASM_OPTIONS " -force_cpusubtype_ALL \ | |
141 %{static}" ASM_MMACOSX_VERSION_MIN_SPEC | |
0 | 142 |
143 #undef ENDFILE_SPEC | |
144 #define ENDFILE_SPEC \ | |
111 | 145 "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ |
0 | 146 %{mpc32:crtprec32.o%s} \ |
147 %{mpc64:crtprec64.o%s} \ | |
111 | 148 %{mpc80:crtprec80.o%s}" TM_DESTRUCTOR |
0 | 149 |
145 | 150 /* We default to x86_64 for single-arch builds, bi-arch overrides. */ |
151 #define DARWIN_ARCH_SPEC "x86_64" | |
152 | |
0 | 153 #undef SUBTARGET_EXTRA_SPECS |
154 #define SUBTARGET_EXTRA_SPECS \ | |
155 DARWIN_EXTRA_SPECS \ | |
145 | 156 { "darwin_arch", DARWIN_ARCH_SPEC }, \ |
0 | 157 { "darwin_crt2", "" }, \ |
145 | 158 { "darwin_subarch", DARWIN_ARCH_SPEC }, |
0 | 159 |
160 /* The Darwin assembler mostly follows AT&T syntax. */ | |
161 #undef ASSEMBLER_DIALECT | |
162 #define ASSEMBLER_DIALECT ASM_ATT | |
163 | |
164 /* Define macro used to output shift-double opcodes when the shift | |
165 count is in %cl. Some assemblers require %cl as an argument; | |
166 some don't. This macro controls what to do: by default, don't | |
167 print %cl. */ | |
168 | |
169 #define SHIFT_DOUBLE_OMITS_COUNT 0 | |
170 | |
171 #undef TARGET_ASM_FILE_END | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
172 #define TARGET_ASM_FILE_END darwin_file_end |
0 | 173 |
174 /* Define the syntax of pseudo-ops, labels and comments. */ | |
175 | |
176 /* String containing the assembler's comment-starter. */ | |
177 | |
178 #define ASM_COMMENT_START "#" | |
179 | |
180 /* By default, target has a 80387, uses IEEE compatible arithmetic, | |
181 and returns float values in the 387. */ | |
182 | |
183 #undef TARGET_SUBTARGET_DEFAULT | |
145 | 184 #define TARGET_SUBTARGET_DEFAULT \ |
185 (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_128BIT_LONG_DOUBLE) | |
0 | 186 |
187 /* For darwin we want to target specific processor features as a minimum, | |
188 but these unfortunately don't correspond to a specific processor. */ | |
189 #undef TARGET_SUBTARGET32_ISA_DEFAULT | |
145 | 190 #define TARGET_SUBTARGET32_ISA_DEFAULT \ |
191 (OPTION_MASK_ISA_MMX | OPTION_MASK_ISA_SSE \ | |
192 | OPTION_MASK_ISA_SSE2 | OPTION_MASK_ISA_SSE3) | |
0 | 193 |
194 #undef TARGET_SUBTARGET64_ISA_DEFAULT | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
195 #define TARGET_SUBTARGET64_ISA_DEFAULT TARGET_SUBTARGET32_ISA_DEFAULT |
0 | 196 |
197 #undef GOT_SYMBOL_NAME | |
198 #define GOT_SYMBOL_NAME MACHOPIC_FUNCTION_BASE_NAME | |
199 | |
200 /* Define the syntax of pseudo-ops, labels and comments. */ | |
201 | |
202 #define LPREFIX "L" | |
203 | |
204 /* Assembler pseudos to introduce constants of various size. */ | |
205 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
206 #define ASM_BYTE "\t.byte\t" |
0 | 207 #define ASM_SHORT "\t.word\t" |
208 #define ASM_LONG "\t.long\t" | |
209 #define ASM_QUAD "\t.quad\t" | |
210 | |
211 #define SUBTARGET_ENCODE_SECTION_INFO darwin_encode_section_info | |
212 | |
213 #undef ASM_OUTPUT_ALIGN | |
145 | 214 #define ASM_OUTPUT_ALIGN(FILE,LOG) \ |
215 do { \ | |
216 if ((LOG) != 0) \ | |
217 { \ | |
218 if (in_section == text_section) \ | |
219 fprintf (FILE, "\t%s %d,0x90\n", ALIGN_ASM_OP, (LOG)); \ | |
220 else \ | |
221 fprintf (FILE, "\t%s %d\n", ALIGN_ASM_OP, (LOG)); \ | |
222 } \ | |
223 } while (0) | |
0 | 224 |
145 | 225 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN |
226 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ | |
227 do { \ | |
228 if ((LOG) != 0) { \ | |
229 if ((MAX_SKIP) == 0 || (MAX_SKIP) >= (1 << (LOG)) - 1) \ | |
230 fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ | |
231 else \ | |
232 fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ | |
233 } \ | |
234 } while (0) | |
235 #endif | |
236 | |
237 /* Darwin x86 assemblers support the .ident directive. */ | |
238 | |
239 #undef TARGET_ASM_OUTPUT_IDENT | |
240 #define TARGET_ASM_OUTPUT_IDENT default_asm_output_ident_directive | |
241 | |
242 /* Darwin profiling -- call mcount. | |
243 If we need a stub, then we unconditionally mark it as used. */ | |
0 | 244 #undef FUNCTION_PROFILER |
245 #define FUNCTION_PROFILER(FILE, LABELNO) \ | |
145 | 246 do { \ |
247 if (TARGET_MACHO_SYMBOL_STUBS \ | |
248 && MACHOPIC_INDIRECT && !TARGET_64BIT) \ | |
249 { \ | |
250 const char *name = machopic_mcount_stub_name (); \ | |
251 fprintf (FILE, "\tcall %s\n", name+1); /* skip '&' */ \ | |
252 } \ | |
253 else fprintf (FILE, "\tcall mcount\n"); \ | |
254 } while (0) | |
0 | 255 |
256 #define C_COMMON_OVERRIDE_OPTIONS \ | |
257 do { \ | |
258 SUBTARGET_C_COMMON_OVERRIDE_OPTIONS; \ | |
259 } while (0) | |
260 | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
261 #undef SUBTARGET_OVERRIDE_OPTIONS |
145 | 262 #define SUBTARGET_OVERRIDE_OPTIONS \ |
263 do { \ | |
264 if (TARGET_64BIT && MACHO_DYNAMIC_NO_PIC_P) \ | |
265 target_flags &= ~MASK_MACHO_DYNAMIC_NO_PIC; \ | |
266 } while (0) | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
267 |
0 | 268 /* Darwin on x86_64 uses dwarf-2 by default. Pre-darwin9 32-bit |
269 compiles default to stabs+. darwin9+ defaults to dwarf-2. */ | |
270 #ifndef DARWIN_PREFER_DWARF | |
271 #undef PREFERRED_DEBUGGING_TYPE | |
111 | 272 #ifdef HAVE_AS_STABS_DIRECTIVE |
0 | 273 #define PREFERRED_DEBUGGING_TYPE (TARGET_64BIT ? DWARF2_DEBUG : DBX_DEBUG) |
111 | 274 #else |
275 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG | |
276 #endif | |
0 | 277 #endif |
278 | |
279 /* Darwin uses the standard DWARF register numbers but the default | |
280 register numbers for STABS. Fortunately for 64-bit code the | |
281 default and the standard are the same. */ | |
282 #undef DBX_REGISTER_NUMBER | |
283 #define DBX_REGISTER_NUMBER(n) \ | |
284 (TARGET_64BIT ? dbx64_register_map[n] \ | |
285 : write_symbols == DWARF2_DEBUG ? svr4_dbx_register_map[n] \ | |
286 : dbx_register_map[n]) | |
287 | |
288 /* Unfortunately, the 32-bit EH information also doesn't use the standard | |
289 DWARF register numbers. */ | |
290 #define DWARF2_FRAME_REG_OUT(n, for_eh) \ | |
291 (! (for_eh) || write_symbols != DWARF2_DEBUG || TARGET_64BIT ? (n) \ | |
292 : (n) == 5 ? 4 \ | |
293 : (n) == 4 ? 5 \ | |
294 : (n) >= 11 && (n) <= 18 ? (n) + 1 \ | |
295 : (n)) | |
296 | |
297 #undef REGISTER_SUBTARGET_PRAGMAS | |
298 #define REGISTER_SUBTARGET_PRAGMAS() DARWIN_REGISTER_TARGET_PRAGMAS() | |
299 | |
300 #undef TARGET_SET_DEFAULT_TYPE_ATTRIBUTES | |
301 #define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES darwin_set_default_type_attributes | |
302 | |
303 /* For 64-bit, we need to add 4 because @GOTPCREL is relative to the | |
304 end of the instruction, but without the 4 we'd only have the right | |
305 address for the start of the instruction. */ | |
306 #undef ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX | |
145 | 307 #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \ |
308 if (TARGET_64BIT) \ | |
309 { \ | |
310 if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_pcrel) \ | |
311 { \ | |
312 fputs (ASM_LONG, FILE); \ | |
313 assemble_name (FILE, XSTR (ADDR, 0)); \ | |
314 fputs ("+4@GOTPCREL", FILE); \ | |
315 goto DONE; \ | |
316 } \ | |
317 } \ | |
318 else \ | |
319 { \ | |
320 if (ENCODING == ASM_PREFERRED_EH_DATA_FORMAT (2, 1)) \ | |
321 { \ | |
322 darwin_non_lazy_pcrel (FILE, ADDR); \ | |
323 goto DONE; \ | |
324 } \ | |
0 | 325 } |
326 | |
145 | 327 /* First available SYMBOL flag bit for use by subtargets. */ |
328 #define SYMBOL_FLAG_SUBT_DEP (SYMBOL_FLAG_MACH_DEP << 5) | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
329 |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
330 #undef MACHOPIC_NL_SYMBOL_PTR_SECTION |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
331 #define MACHOPIC_NL_SYMBOL_PTR_SECTION \ |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
332 ".section __IMPORT,__pointers,non_lazy_symbol_pointers" |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
333 |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
334 #define SUBTARGET32_DEFAULT_CPU "i686" |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
335 |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
336 #undef SUBTARGET_INIT_BUILTINS |
145 | 337 #define SUBTARGET_INIT_BUILTINS \ |
338 do { \ | |
339 ix86_builtins[(int) IX86_BUILTIN_CFSTRING] \ | |
340 = darwin_init_cfstring_builtins ((unsigned) (IX86_BUILTIN_CFSTRING)); \ | |
341 darwin_rename_builtins (); \ | |
342 } while(0) |