[RS6000] PR11848 rs6000_emit_move long double split
[platform/upstream/gcc.git] / gcc / config / darwin.h
1 /* Target definitions for Darwin (Mac OS X) systems.
2    Copyright (C) 1989-2018 Free Software Foundation, Inc.
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 Under Section 7 of GPL version 3, you are granted additional
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
24 <http://www.gnu.org/licenses/>.  */
25
26 #ifndef CONFIG_DARWIN_H
27 #define CONFIG_DARWIN_H
28
29 /* The definitions in this file are common to all processor types
30    running Darwin, which is the kernel for Mac OS X.  Darwin is
31    basically a BSD user layer laid over a Mach kernel, then evolved
32    for many years (at NeXT) in parallel with other Unix systems.  So
33    while the runtime is a somewhat idiosyncratic Mach-based thing,
34    other definitions look like they would for a BSD variant.  */
35
36 /* Although NeXT ran on many different architectures, as of Jan 2001
37    the only supported Darwin targets are PowerPC and x86.  */
38
39 /* One of Darwin's NeXT legacies is the Mach-O format, which is partly
40    like a.out and partly like COFF, with additional features like
41    multi-architecture binary support.  */
42
43 #define DARWIN_X86 0
44 #define DARWIN_PPC 0
45
46 /* Suppress g++ attempt to link in the math library automatically. */
47 #define MATH_LIBRARY ""
48
49 /* We have atexit.  */
50
51 #define HAVE_ATEXIT
52
53 /* Define an empty body for the function do_global_dtors() in libgcc2.c.  */
54
55 #define DO_GLOBAL_DTORS_BODY
56
57 /* The string value for __SIZE_TYPE__.  */
58
59 #ifndef SIZE_TYPE
60 #define SIZE_TYPE "long unsigned int"
61 #endif
62
63 /* Type used for ptrdiff_t, as a string used in a declaration.  */
64
65 #undef  PTRDIFF_TYPE
66 #define PTRDIFF_TYPE "int"
67
68 /* wchar_t is int.  */
69
70 #undef  WCHAR_TYPE
71 #define WCHAR_TYPE "int"
72 #undef  WCHAR_TYPE_SIZE
73 #define WCHAR_TYPE_SIZE 32
74
75 #define INT8_TYPE "signed char"
76 #define INT16_TYPE "short int"
77 #define INT32_TYPE "int"
78 #define INT64_TYPE "long long int"
79 #define UINT8_TYPE "unsigned char"
80 #define UINT16_TYPE "short unsigned int"
81 #define UINT32_TYPE "unsigned int"
82 #define UINT64_TYPE "long long unsigned int"
83
84 #define INT_LEAST8_TYPE "signed char"
85 #define INT_LEAST16_TYPE "short int"
86 #define INT_LEAST32_TYPE "int"
87 #define INT_LEAST64_TYPE "long long int"
88 #define UINT_LEAST8_TYPE "unsigned char"
89 #define UINT_LEAST16_TYPE "short unsigned int"
90 #define UINT_LEAST32_TYPE "unsigned int"
91 #define UINT_LEAST64_TYPE "long long unsigned int"
92
93 #define INT_FAST8_TYPE "signed char"
94 #define INT_FAST16_TYPE "short int"
95 #define INT_FAST32_TYPE "int"
96 #define INT_FAST64_TYPE "long long int"
97 #define UINT_FAST8_TYPE "unsigned char"
98 #define UINT_FAST16_TYPE "short unsigned int"
99 #define UINT_FAST32_TYPE "unsigned int"
100 #define UINT_FAST64_TYPE "long long unsigned int"
101
102 #define INTPTR_TYPE "long int"
103 #define UINTPTR_TYPE "long unsigned int"
104
105 #define SIG_ATOMIC_TYPE "int"
106
107 /* Default to using the NeXT-style runtime, since that's what is
108    pre-installed on Darwin systems.  */
109
110 #define NEXT_OBJC_RUNTIME 1
111
112 /* Don't default to pcc-struct-return, because gcc is the only compiler, and
113    we want to retain compatibility with older gcc versions.  */
114
115 #undef  DEFAULT_PCC_STRUCT_RETURN
116 #define DEFAULT_PCC_STRUCT_RETURN 0
117
118 /* True if pragma ms_struct is in effect.  */
119 extern GTY(()) int darwin_ms_struct;
120
121 #define DRIVER_SELF_SPECS                                       \
122   "%{gfull:-g -fno-eliminate-unused-debug-symbols} %<gfull",    \
123   "%{gused:-g -feliminate-unused-debug-symbols} %<gused",       \
124   "%{fapple-kext|mkernel:-static}",                             \
125   "%{shared:-Zdynamiclib} %<shared",                            \
126   "%{gsplit-dwarf:%ngsplit-dwarf is not supported on this platform } \
127      %<gsplit-dwarf"
128
129 #define DARWIN_CC1_SPEC                                                 \
130   "%{findirect-virtual-calls: -fapple-kext} %<findirect-virtual-calls " \
131   "%{fterminated-vtables: -fapple-kext} %<fterminated-vtables "         \
132   "%<filelist* %<framework*"
133
134 #define SUBSUBTARGET_OVERRIDE_OPTIONS                                   \
135   do {                                                                  \
136     darwin_override_options ();                                         \
137   } while (0)
138
139 #define SUBTARGET_C_COMMON_OVERRIDE_OPTIONS do {                        \
140     if (flag_mkernel || flag_apple_kext)                                \
141       {                                                                 \
142         if (flag_use_cxa_atexit == 2)                                   \
143           flag_use_cxa_atexit = 0;                                      \
144         /* kexts should always be built without the coalesced sections  \
145            because the kernel loader doesn't grok such sections.  */    \
146         flag_weak = 0;                                                  \
147         /* No RTTI in kexts.  */                                        \
148         flag_rtti = 0;                                                  \
149       }                                                                 \
150   } while (0)
151
152 /* Machine dependent cpp options.  Don't add more options here, add
153    them to darwin_cpp_builtins in darwin-c.c.  */
154
155 #undef  CPP_SPEC
156 #define CPP_SPEC "%{static:%{!dynamic:-D__STATIC__}}%{!static:-D__DYNAMIC__}" \
157         " %{pthread:-D_REENTRANT}"
158
159 /* This is mostly a clone of the standard LINK_COMMAND_SPEC, plus
160    precomp, libtool, and fat build additions.
161
162    In general, random Darwin linker flags should go into LINK_SPEC
163    instead of LINK_COMMAND_SPEC.  The command spec is better for
164    specifying the handling of options understood by generic Unix
165    linkers, and for positional arguments like libraries.  */
166
167 #if LD64_HAS_EXPORT_DYNAMIC
168 #define DARWIN_EXPORT_DYNAMIC " %{rdynamic:-export_dynamic}"
169 #else
170 #define DARWIN_EXPORT_DYNAMIC " %{rdynamic: %nrdynamic is not supported}"
171 #endif
172
173 #define LINK_COMMAND_SPEC_A \
174    "%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
175     %(linker)" \
176     LINK_PLUGIN_SPEC \
177     "%{flto*:%<fcompare-debug*} \
178      %{flto} %{fno-lto} %{flto=*} \
179     %l " LINK_COMPRESS_DEBUG_SPEC \
180    "%X %{s} %{t} %{Z} %{u*} \
181     %{e*} %{r} \
182     %{o*}%{!o:-o a.out} \
183     %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
184     %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} \
185     %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1): \
186       %{static|static-libgcc|static-libstdc++|static-libgfortran: libgomp.a%s; : -lgomp } } \
187     %{fgnu-tm: \
188       %{static|static-libgcc|static-libstdc++|static-libgfortran: libitm.a%s; : -litm } } \
189     %{!nostdlib:%{!r:%{!nodefaultlibs:\
190       %{%:sanitize(address): -lasan } \
191       %{%:sanitize(undefined): -lubsan } \
192       %(link_ssp) \
193       " DARWIN_EXPORT_DYNAMIC " %<rdynamic \
194       %(link_gcc_c_sequence) \
195     }}}\
196     %{!nostdlib:%{!r:%{!nostartfiles:%E}}} %{T*} %{F*} }}}}}}}"
197
198 #define DSYMUTIL "\ndsymutil"
199
200 #define DSYMUTIL_SPEC \
201    "%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
202     %{v} \
203     %{gdwarf-2:%{!gstabs*:%{%:debug-level-gt(0): -idsym}}}\
204     %{.c|.cc|.C|.cpp|.cp|.c++|.cxx|.CPP|.m|.mm: \
205     %{gdwarf-2:%{!gstabs*:%{%:debug-level-gt(0): -dsym}}}}}}}}}}}"
206
207 #define LINK_COMMAND_SPEC LINK_COMMAND_SPEC_A DSYMUTIL_SPEC
208
209 /* Tell collect2 to run dsymutil for us as necessary.  */
210 #define COLLECT_RUN_DSYMUTIL 1
211
212 /* We only want one instance of %G, since libSystem (Darwin's -lc) does not depend
213    on libgcc.  */
214 #undef  LINK_GCC_C_SEQUENCE_SPEC
215 #define LINK_GCC_C_SEQUENCE_SPEC "%G %{!nolibc:%L}"
216
217 /* ld64 supports a sysroot, it just has a different name and there's no easy
218    way to check for it at config time.  */
219 #undef HAVE_LD_SYSROOT
220 #define HAVE_LD_SYSROOT 1
221 /* It seems the only (working) way to get a space after %R is to append a
222    dangling '/'.  */
223 #define SYSROOT_SPEC "%{!isysroot*:-syslibroot %R/ }"
224
225 /* Do the same as clang, for now, and insert the sysroot for ld when an
226    isysroot is specified.  */
227 #define LINK_SYSROOT_SPEC "%{isysroot*:-syslibroot %*}"
228
229 /* Suppress the addition of extra prefix paths when a sysroot is in use.  */
230 #define STANDARD_STARTFILE_PREFIX_1 ""
231 #define STANDARD_STARTFILE_PREFIX_2 ""
232
233 #define DARWIN_PIE_SPEC "%{fpie|pie|fPIE:}"
234
235 /* Please keep the random linker options in alphabetical order (modulo
236    'Z' and 'no' prefixes). Note that options taking arguments may appear
237    multiple times on a command line with different arguments each time,
238    so put a * after their names so all of them get passed.  */
239 #define LINK_SPEC  \
240   "%{static}%{!static:-dynamic} \
241    %:remove-outfile(-ldl) \
242    %:remove-outfile(-lm) \
243    %:remove-outfile(-lpthread) \
244    %{fgnu-runtime: %{static|static-libgcc: \
245                      %:replace-outfile(-lobjc libobjc-gnu.a%s); \
246                     :%:replace-outfile(-lobjc -lobjc-gnu ) } }\
247    %{static|static-libgcc|static-libgfortran:%:replace-outfile(-lgfortran libgfortran.a%s)}\
248    %{static|static-libgcc|static-libstdc++|static-libgfortran:%:replace-outfile(-lgomp libgomp.a%s)}\
249    %{static|static-libgcc|static-libstdc++:%:replace-outfile(-lstdc++ libstdc++.a%s)}\
250    %{!Zdynamiclib: \
251      %{Zforce_cpusubtype_ALL:-arch %(darwin_arch) -force_cpusubtype_ALL} \
252      %{!Zforce_cpusubtype_ALL:-arch %(darwin_subarch)} \
253      %{Zbundle:-bundle} \
254      %{Zbundle_loader*:-bundle_loader %*} \
255      %{client_name*} \
256      %{compatibility_version*:%e-compatibility_version only allowed with -dynamiclib\
257 } \
258      %{current_version*:%e-current_version only allowed with -dynamiclib} \
259      %{Zforce_flat_namespace:-force_flat_namespace} \
260      %{Zinstall_name*:%e-install_name only allowed with -dynamiclib} \
261      %{keep_private_externs} \
262      %{private_bundle} \
263     } \
264    %{Zdynamiclib: -dylib \
265      %{Zbundle:%e-bundle not allowed with -dynamiclib} \
266      %{Zbundle_loader*:%e-bundle_loader not allowed with -dynamiclib} \
267      %{client_name*:%e-client_name not allowed with -dynamiclib} \
268      %{compatibility_version*:-dylib_compatibility_version %*} \
269      %{current_version*:-dylib_current_version %*} \
270      %{Zforce_cpusubtype_ALL:-arch %(darwin_arch)} \
271      %{!Zforce_cpusubtype_ALL: -arch %(darwin_subarch)} \
272      %{Zforce_flat_namespace:%e-force_flat_namespace not allowed with -dynamiclib} \
273      %{Zinstall_name*:-dylib_install_name %*} \
274      %{keep_private_externs:%e-keep_private_externs not allowed with -dynamiclib} \
275      %{private_bundle:%e-private_bundle not allowed with -dynamiclib} \
276     } \
277    %{Zall_load:-all_load} \
278    %{Zallowable_client*:-allowable_client %*} \
279    %{Zbind_at_load:-bind_at_load} \
280    %{Zarch_errors_fatal:-arch_errors_fatal} \
281    %{Zdead_strip:-dead_strip} \
282    %{Zno_dead_strip_inits_and_terms:-no_dead_strip_inits_and_terms} \
283    %{Zdylib_file*:-dylib_file %*} \
284    %{Zdynamic:-dynamic}\
285    %{Zexported_symbols_list*:-exported_symbols_list %*} \
286    %{Zflat_namespace:-flat_namespace} \
287    %{headerpad_max_install_names} \
288    %{Zimage_base*:-image_base %*} \
289    %{Zinit*:-init %*} \
290    %{mmacosx-version-min=*:-macosx_version_min %*} \
291    %{nomultidefs} \
292    %{Zmulti_module:-multi_module} %{Zsingle_module:-single_module} \
293    %{Zmultiply_defined*:-multiply_defined %*} \
294    %{!Zmultiply_defined*:%{shared-libgcc: \
295      %:version-compare(< 10.5 mmacosx-version-min= -multiply_defined) \
296      %:version-compare(< 10.5 mmacosx-version-min= suppress)}} \
297    %{Zmultiplydefinedunused*:-multiply_defined_unused %*} \
298    " DARWIN_PIE_SPEC " \
299    %{prebind} %{noprebind} %{nofixprebinding} %{prebind_all_twolevel_modules} \
300    %{read_only_relocs} \
301    %{sectcreate*} %{sectorder*} %{seg1addr*} %{segprot*} \
302    %{Zsegaddr*:-segaddr %*} \
303    %{Zsegs_read_only_addr*:-segs_read_only_addr %*} \
304    %{Zsegs_read_write_addr*:-segs_read_write_addr %*} \
305    %{Zseg_addr_table*: -seg_addr_table %*} \
306    %{Zfn_seg_addr_table_filename*:-seg_addr_table_filename %*} \
307    %{sub_library*} %{sub_umbrella*} \
308    " LINK_SYSROOT_SPEC " \
309    %{twolevel_namespace} %{twolevel_namespace_hints} \
310    %{Zumbrella*: -umbrella %*} \
311    %{undefined*} \
312    %{Zunexported_symbols_list*:-unexported_symbols_list %*} \
313    %{Zweak_reference_mismatches*:-weak_reference_mismatches %*} \
314    %{!Zweak_reference_mismatches*:-weak_reference_mismatches non-weak} \
315    %{X} \
316    %{y*} \
317    %{w} \
318    %{pagezero_size*} %{segs_read_*} %{seglinkedit} %{noseglinkedit}  \
319    %{sectalign*} %{sectobjectsymbols*} %{segcreate*} %{whyload} \
320    %{whatsloaded} %{dylinker_install_name*} \
321    %{dylinker} %{Mach} "
322
323
324 /* Machine dependent libraries.  */
325
326 #define LIB_SPEC "%{!static:-lSystem}"
327
328 /* Support -mmacosx-version-min by supplying different (stub) libgcc_s.dylib
329    libraries to link against, and by not linking against libgcc_s on
330    earlier-than-10.3.9.
331
332    Note that by default, -lgcc_eh is not linked against!  This is
333    because in a future version of Darwin the EH frame information may
334    be in a new format, or the fallback routine might be changed; if
335    you want to explicitly link against the static version of those
336    routines, because you know you don't need to unwind through system
337    libraries, you need to explicitly say -static-libgcc.
338
339    If it is linked against, it has to be before -lgcc, because it may
340    need symbols from -lgcc.  */
341 #undef REAL_LIBGCC_SPEC
342 #define REAL_LIBGCC_SPEC                                                   \
343    "%{static-libgcc|static: -lgcc_eh -lgcc;                                \
344       shared-libgcc|fexceptions|fgnu-runtime:                              \
345        %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_s.10.4)        \
346        %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5)   \
347        %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_ext.10.4)      \
348        %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_ext.10.5)      \
349        -lgcc ;                                                             \
350       :%:version-compare(>< 10.3.9 10.5 mmacosx-version-min= -lgcc_s.10.4) \
351        %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5)   \
352        %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_ext.10.4)      \
353        %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_ext.10.5)      \
354        -lgcc }"
355
356 /* We specify crt0.o as -lcrt0.o so that ld will search the library path.
357
358    crt3.o provides __cxa_atexit on systems that don't have it.  Since
359    it's only used with C++, which requires passing -shared-libgcc, key
360    off that to avoid unnecessarily adding a destructor to every
361    powerpc program built.  */
362
363 #undef  STARTFILE_SPEC
364 #define STARTFILE_SPEC                                                      \
365   "%{Zdynamiclib: %(darwin_dylib1) %{fgnu-tm: -lcrttms.o}}                  \
366    %{!Zdynamiclib:%{Zbundle:%{!static:                                      \
367         %:version-compare(< 10.6 mmacosx-version-min= -lbundle1.o)          \
368         %{fgnu-tm: -lcrttms.o}}}                                            \
369      %{!Zbundle:%{pg:%{static:-lgcrt0.o}                                    \
370                      %{!static:%{object:-lgcrt0.o}                          \
371                                %{!object:%{preload:-lgcrt0.o}               \
372                                  %{!preload:-lgcrt1.o                       \
373                                  %:version-compare(>= 10.8 mmacosx-version-min= -no_new_main) \
374                                  %(darwin_crt2)}}}}    \
375                 %{!pg:%{static:-lcrt0.o}                                    \
376                       %{!static:%{object:-lcrt0.o}                          \
377                                 %{!object:%{preload:-lcrt0.o}               \
378                                   %{!preload: %(darwin_crt1)                \
379                                               %(darwin_crt2)}}}}}}          \
380   %{shared-libgcc:%:version-compare(< 10.5 mmacosx-version-min= crt3.o%s)}"
381
382 /* We want a destructor last in the list.  */
383 #define TM_DESTRUCTOR "%{fgnu-tm: -lcrttme.o}"
384 #define ENDFILE_SPEC TM_DESTRUCTOR
385
386 #define DARWIN_EXTRA_SPECS                                              \
387   { "darwin_crt1", DARWIN_CRT1_SPEC },                                  \
388   { "darwin_dylib1", DARWIN_DYLIB1_SPEC },
389
390 #define DARWIN_DYLIB1_SPEC                                              \
391   "%:version-compare(!> 10.5 mmacosx-version-min= -ldylib1.o)           \
392    %:version-compare(>< 10.5 10.6 mmacosx-version-min= -ldylib1.10.5.o)"
393
394 #define DARWIN_CRT1_SPEC                                                \
395   "%:version-compare(!> 10.5 mmacosx-version-min= -lcrt1.o)             \
396    %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lcrt1.10.5.o)   \
397    %:version-compare(>< 10.6 10.8 mmacosx-version-min= -lcrt1.10.6.o)   \
398    %{fgnu-tm: -lcrttms.o}"
399
400 #ifdef HAVE_AS_MMACOSX_VERSION_MIN_OPTION
401 /* Emit macosx version (but only major).  */
402 #define ASM_MMACOSX_VERSION_MIN_SPEC \
403   " %{asm_macosx_version_min=*: -mmacosx-version-min=%*} %<asm_macosx_version_min=*"
404 #else
405 #define ASM_MMACOSX_VERSION_MIN_SPEC " %<asm_macosx_version_min=*"
406 #endif
407
408 /* When we detect that we're cctools or llvm as, we need to insert the right
409    additional options.  */
410 #if HAVE_GNU_AS
411 #define ASM_OPTIONS ""
412 #else
413 #define ASM_OPTIONS "%{v} %{w:-W} %{I*}"
414 #endif
415
416 /* Default Darwin ASM_SPEC, very simple. */
417 #define ASM_SPEC "-arch %(darwin_arch) \
418   " ASM_OPTIONS " \
419   %{Zforce_cpusubtype_ALL:-force_cpusubtype_ALL} \
420   %{static}" ASM_MMACOSX_VERSION_MIN_SPEC
421
422 /* Default ASM_DEBUG_SPEC.  Darwin's as cannot currently produce dwarf
423    debugging data.  */
424
425 #define ASM_DEBUG_SPEC  "%{g*:%{%:debug-level-gt(0):%{!gdwarf*:--gstabs}}}"
426 #define ASM_FINAL_SPEC \
427   "%{gsplit-dwarf:%ngsplit-dwarf is not supported on this platform } %<gsplit-dwarf"
428
429 /* We still allow output of STABS if the assembler supports it.  */
430 #ifdef HAVE_AS_STABS_DIRECTIVE
431 #define DBX_DEBUGGING_INFO 1
432 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
433 #endif
434
435 #define DWARF2_DEBUGGING_INFO 1
436
437 #define DEBUG_FRAME_SECTION       "__DWARF,__debug_frame,regular,debug"
438 #define DEBUG_INFO_SECTION        "__DWARF,__debug_info,regular,debug"
439 #define DEBUG_ABBREV_SECTION      "__DWARF,__debug_abbrev,regular,debug"
440 #define DEBUG_ARANGES_SECTION     "__DWARF,__debug_aranges,regular,debug"
441 #define DEBUG_MACINFO_SECTION     "__DWARF,__debug_macinfo,regular,debug"
442 #define DEBUG_LINE_SECTION        "__DWARF,__debug_line,regular,debug"
443 #define DEBUG_LOC_SECTION         "__DWARF,__debug_loc,regular,debug"
444 #define DEBUG_LOCLISTS_SECTION    "__DWARF,__debug_loclists,regular,debug"
445
446 #define DEBUG_STR_SECTION         "__DWARF,__debug_str,regular,debug"
447 #define DEBUG_STR_OFFSETS_SECTION "__DWARF,__debug_str_offs,regular,debug"
448 #define DEBUG_RANGES_SECTION      "__DWARF,__debug_ranges,regular,debug"
449 #define DEBUG_RNGLISTS_SECTION    "__DWARF,__debug_rnglists,regular,debug"
450 #define DEBUG_MACRO_SECTION       "__DWARF,__debug_macro,regular,debug"
451
452 #define DEBUG_LTO_INFO_SECTION    "__GNU_DWARF_LTO,__debug_info,regular,debug"
453 #define DEBUG_LTO_ABBREV_SECTION  "__GNU_DWARF_LTO,__debug_abbrev,regular,debug"
454 #define DEBUG_LTO_MACINFO_SECTION "__GNU_DWARF_LTO,__debug_macinfo,regular,debug"
455 #define DEBUG_LTO_LINE_SECTION    "__GNU_DWARF_LTO,__debug_line,regular,debug"
456 #define DEBUG_LTO_STR_SECTION     "__GNU_DWARF_LTO,__debug_str,regular,debug"
457 #define DEBUG_LTO_MACRO_SECTION   "__GNU_DWARF_LTO,__debug_macro,regular,debug"
458
459 #define TARGET_WANT_DEBUG_PUB_SECTIONS true
460 #define DEBUG_PUBNAMES_SECTION   ((debug_generate_pub_sections == 2) \
461                                ? "__DWARF,__debug_gnu_pubn,regular,debug" \
462                                : "__DWARF,__debug_pubnames,regular,debug")
463
464 #define DEBUG_PUBTYPES_SECTION   ((debug_generate_pub_sections == 2) \
465                                ? "__DWARF,__debug_gnu_pubt,regular,debug" \
466                                : "__DWARF,__debug_pubtypes,regular,debug")
467
468 /* When generating stabs debugging, use N_BINCL entries.  */
469
470 #define DBX_USE_BINCL
471
472 /* There is no limit to the length of stabs strings.  */
473
474 #define DBX_CONTIN_LENGTH 0
475
476 /* gdb needs a null N_SO at the end of each file for scattered loading.  */
477
478 #define DBX_OUTPUT_NULL_N_SO_AT_MAIN_SOURCE_FILE_END
479
480 /* GCC's definition of 'one_only' is the same as its definition of 'weak'.  */
481 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
482
483 /* Mach-O supports 'weak imports', and 'weak definitions' in coalesced
484    sections.  machopic_select_section ensures that weak variables go in
485    coalesced sections.  Weak aliases (or any other kind of aliases) are
486    not supported.  Weak symbols that aren't visible outside the .s file
487    are not supported.  */
488 #define ASM_WEAKEN_DECL(FILE, DECL, NAME, ALIAS)                        \
489   do {                                                                  \
490     if (ALIAS)                                                          \
491       {                                                                 \
492         warning (0, "alias definitions not supported in Mach-O; ignored");      \
493         break;                                                          \
494       }                                                                 \
495                                                                         \
496     if (! DECL_EXTERNAL (DECL) && TREE_PUBLIC (DECL))                   \
497       targetm.asm_out.globalize_label (FILE, NAME);                     \
498     if (DECL_EXTERNAL (DECL))                                           \
499       fputs ("\t.weak_reference ", FILE);                               \
500     else if (lookup_attribute ("weak_import", DECL_ATTRIBUTES (DECL)))  \
501       break;                                                            \
502     else if (TREE_PUBLIC (DECL))                                        \
503       fputs ("\t.weak_definition ", FILE);                              \
504     else                                                                \
505       break;                                                            \
506     assemble_name (FILE, NAME);                                         \
507     fputc ('\n', FILE);                                                 \
508   } while (0)
509
510 /* Darwin has the pthread routines in libSystem, which every program
511    links to, so there's no need for weak-ness for that.  */
512 #define GTHREAD_USE_WEAK 0
513
514 /* The Darwin linker doesn't want coalesced symbols to appear in
515    a static archive's table of contents. */
516 #undef TARGET_WEAK_NOT_IN_ARCHIVE_TOC
517 #define TARGET_WEAK_NOT_IN_ARCHIVE_TOC 1
518
519 /* On Darwin, we don't (at the time of writing) have linkonce sections
520    with names, so it's safe to make the class data not comdat.  */
521 #define TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT hook_bool_void_false
522
523 /* For efficiency, on Darwin the RTTI information that is always
524    emitted in the standard C++ library should not be COMDAT.  */
525 #define TARGET_CXX_LIBRARY_RTTI_COMDAT hook_bool_void_false
526
527 /* We make exception information linkonce. */
528 #undef TARGET_USES_WEAK_UNWIND_INFO
529 #define TARGET_USES_WEAK_UNWIND_INFO 1
530
531 /* We need to use a nonlocal label for the start of an EH frame: the
532    Darwin linker requires that a coalesced section start with a label.
533    Unfortunately, it also requires that 'debug' sections don't contain
534    labels.  */
535 #undef FRAME_BEGIN_LABEL
536 #define FRAME_BEGIN_LABEL (for_eh ? "EH_frame" : "Lframe")
537
538 /* Emit a label for the FDE corresponding to DECL.  EMPTY means
539    emit a label for an empty FDE. */
540 #define TARGET_ASM_EMIT_UNWIND_LABEL darwin_emit_unwind_label
541
542 /* Emit a label to separate the exception table.  */
543 #define TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL darwin_emit_except_table_label
544
545 /* Our profiling scheme doesn't LP labels and counter words.  */
546
547 #define NO_PROFILE_COUNTERS     1
548
549 #undef  INIT_SECTION_ASM_OP
550 #define INIT_SECTION_ASM_OP ""
551
552 #undef  INVOKE__main
553
554 #define TARGET_ASM_CONSTRUCTOR  machopic_asm_out_constructor
555 #define TARGET_ASM_DESTRUCTOR   machopic_asm_out_destructor
556
557 /* Always prefix with an underscore.  */
558
559 #define USER_LABEL_PREFIX "_"
560
561 /* A dummy symbol that will be replaced with the function base name.  */
562 #define MACHOPIC_FUNCTION_BASE_NAME "<pic base>"
563
564 /* Don't output a .file directive.  That is only used by the assembler for
565    error reporting.  */
566 #undef  TARGET_ASM_FILE_START_FILE_DIRECTIVE
567 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE false
568
569 #undef  TARGET_ASM_FILE_END
570 #define TARGET_ASM_FILE_END darwin_file_end
571
572 /* Because Mach-O relocations have a counter from 1 to 255 for the
573    section number they apply to, it is necessary to output all
574    normal sections before the LTO sections, to make sure that the
575    sections that may have relocations always have a section number
576    smaller than 255.  */
577 #undef  TARGET_ASM_LTO_START
578 #define TARGET_ASM_LTO_START darwin_asm_lto_start
579 #undef  TARGET_ASM_LTO_END
580 #define TARGET_ASM_LTO_END darwin_asm_lto_end
581
582 #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
583   fprintf (FILE, "\t.space " HOST_WIDE_INT_PRINT_UNSIGNED"\n", SIZE)
584
585 /* Give ObjC methods pretty symbol names.  */
586
587 #undef  OBJC_GEN_METHOD_LABEL
588 #define OBJC_GEN_METHOD_LABEL(BUF,IS_INST,CLASS_NAME,CAT_NAME,SEL_NAME,NUM) \
589   do { if (CAT_NAME)                                                    \
590          sprintf (BUF, "%c[%s(%s) %s]", (IS_INST) ? '-' : '+',          \
591                   (CLASS_NAME), (CAT_NAME), (SEL_NAME));                \
592        else                                                             \
593          sprintf (BUF, "%c[%s %s]", (IS_INST) ? '-' : '+',              \
594                   (CLASS_NAME), (SEL_NAME));                            \
595      } while (0)
596
597 #undef ASM_DECLARE_OBJECT_NAME
598 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
599         darwin_asm_declare_object_name ((FILE), (NAME), (DECL))
600
601 /* The RTTI data (e.g., __ti4name) is common and public (and static),
602    but it does need to be referenced via indirect PIC data pointers.
603    The machopic_define_symbol calls are telling the machopic subsystem
604    that the name *is* defined in this module, so it doesn't need to
605    make them indirect.  */
606
607 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)                     \
608   do {                                                                  \
609     const char *xname = NAME;                                           \
610     if (GET_CODE (XEXP (DECL_RTL (DECL), 0)) != SYMBOL_REF)             \
611       xname = IDENTIFIER_POINTER (DECL_NAME (DECL));                    \
612     if (! DECL_WEAK (DECL)                                              \
613         && ((TREE_STATIC (DECL)                                         \
614              && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL)))           \
615             || DECL_INITIAL (DECL)))                                    \
616         machopic_define_symbol (DECL_RTL (DECL));                       \
617     if ((TREE_STATIC (DECL)                                             \
618          && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL)))               \
619         || DECL_INITIAL (DECL))                                         \
620       (* targetm.encode_section_info) (DECL, DECL_RTL (DECL), false);   \
621     ASM_OUTPUT_FUNCTION_LABEL (FILE, xname, DECL);                      \
622   } while (0)
623
624 #undef TARGET_ASM_DECLARE_CONSTANT_NAME
625 #define TARGET_ASM_DECLARE_CONSTANT_NAME darwin_asm_declare_constant_name
626
627 /* Wrap new method names in quotes so the assembler doesn't gag.
628    Make Objective-C internal symbols local and in doing this, we need 
629    to accommodate the name mangling done by c++ on file scope locals.  */
630
631 int darwin_label_is_anonymous_local_objc_name (const char *name);
632
633 #undef  ASM_OUTPUT_LABELREF
634 #define ASM_OUTPUT_LABELREF(FILE,NAME)                                       \
635   do {                                                                       \
636        const char *xname = (NAME);                                           \
637        if (! strcmp (xname, MACHOPIC_FUNCTION_BASE_NAME))                    \
638          machopic_output_function_base_name(FILE);                           \
639        else if (xname[0] == '&' || xname[0] == '*')                          \
640          {                                                                   \
641            int len = strlen (xname);                                         \
642            if (len > 6 && !strcmp ("$stub", xname + len - 5))                \
643              machopic_validate_stub_or_non_lazy_ptr (xname);                 \
644            else if (len > 7 && !strcmp ("$stub\"", xname + len - 6))         \
645              machopic_validate_stub_or_non_lazy_ptr (xname);                 \
646            else if (len > 14 && !strcmp ("$non_lazy_ptr", xname + len - 13)) \
647              machopic_validate_stub_or_non_lazy_ptr (xname);                 \
648            else if (len > 15 && !strcmp ("$non_lazy_ptr\"", xname + len - 14)) \
649              machopic_validate_stub_or_non_lazy_ptr (xname);                 \
650            if (xname[1] != '"' && name_needs_quotes (&xname[1]))             \
651              fprintf (FILE, "\"%s\"", &xname[1]);                            \
652            else                                                              \
653              fputs (&xname[1], FILE);                                        \
654          }                                                                   \
655        else if (xname[0] == '+' || xname[0] == '-')                          \
656          fprintf (FILE, "\"%s\"", xname);                                    \
657        else if (darwin_label_is_anonymous_local_objc_name (xname))           \
658          fprintf (FILE, "L%s", xname);                                       \
659        else if (xname[0] != '"' && name_needs_quotes (xname))                \
660          asm_fprintf (FILE, "\"%U%s\"", xname);                              \
661        else                                                                  \
662          asm_fprintf (FILE, "%U%s", xname);                                  \
663   } while (0)
664
665 /* Output before executable code.  */
666 #undef TEXT_SECTION_ASM_OP
667 #define TEXT_SECTION_ASM_OP "\t.text"
668
669 /* Output before writable data.  */
670
671 #undef DATA_SECTION_ASM_OP
672 #define DATA_SECTION_ASM_OP "\t.data"
673
674 #undef  ALIGN_ASM_OP
675 #define ALIGN_ASM_OP            ".align"
676
677 #undef  ASM_OUTPUT_ALIGN
678 #define ASM_OUTPUT_ALIGN(FILE,LOG)      \
679   if ((LOG) != 0)                       \
680     fprintf (FILE, "\t%s\t%d\n", ALIGN_ASM_OP, (LOG))
681
682 /* The maximum alignment which the object file format can support in
683    bits.  For Mach-O, this is 2^15 bytes.  */
684
685 #undef  MAX_OFILE_ALIGNMENT
686 #define MAX_OFILE_ALIGNMENT (0x8000 * 8)
687
688 #define L2_MAX_OFILE_ALIGNMENT 15
689
690 /*  These are the three variants that emit referenced blank space.  */
691 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN)           \
692         darwin_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
693
694 #undef  ASM_OUTPUT_ALIGNED_DECL_LOCAL
695 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN)    \
696         darwin_asm_output_aligned_decl_local                            \
697                                   ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
698
699 #undef  ASM_OUTPUT_ALIGNED_DECL_COMMON
700 #define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN)   \
701         darwin_asm_output_aligned_decl_common                           \
702                                    ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
703
704 /* The generic version, archs should over-ride where required.  */
705 #define MACHOPIC_NL_SYMBOL_PTR_SECTION ".non_lazy_symbol_pointer"
706
707 /* Declare the section variables.  */
708 #ifndef USED_FOR_TARGET
709 enum darwin_section_enum {
710 #define DEF_SECTION(NAME, FLAGS, DIRECTIVE, OBJC) NAME,
711 #include "darwin-sections.def"
712 #undef DEF_SECTION
713   NUM_DARWIN_SECTIONS
714 };
715 extern GTY(()) section * darwin_sections[NUM_DARWIN_SECTIONS];
716 #endif
717
718 #undef  TARGET_ASM_SELECT_SECTION
719 #define TARGET_ASM_SELECT_SECTION machopic_select_section
720
721 #undef  TARGET_ASM_FUNCTION_SECTION
722 #define TARGET_ASM_FUNCTION_SECTION darwin_function_section
723
724 #undef  TARGET_ASM_SELECT_RTX_SECTION
725 #define TARGET_ASM_SELECT_RTX_SECTION machopic_select_rtx_section
726 #undef  TARGET_ASM_UNIQUE_SECTION
727 #define TARGET_ASM_UNIQUE_SECTION darwin_unique_section
728 #undef  TARGET_ASM_FUNCTION_RODATA_SECTION
729 #define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
730
731 #undef  TARGET_ASM_TM_CLONE_TABLE_SECTION
732 #define TARGET_ASM_TM_CLONE_TABLE_SECTION darwin_tm_clone_table_section
733
734 #undef  TARGET_ASM_RELOC_RW_MASK
735 #define TARGET_ASM_RELOC_RW_MASK machopic_reloc_rw_mask
736
737 /* Globalizing directive for a label.  */
738 #define GLOBAL_ASM_OP "\t.globl "
739 #define TARGET_ASM_GLOBALIZE_LABEL darwin_globalize_label
740
741 /* Emit an assembler directive to set visibility for a symbol.  Used
742    to support visibility attribute and Darwin's private extern
743    feature.  */
744 #undef TARGET_ASM_ASSEMBLE_VISIBILITY
745 #define TARGET_ASM_ASSEMBLE_VISIBILITY darwin_assemble_visibility
746
747 /* Extra attributes for Darwin.  */
748 #define SUBTARGET_ATTRIBUTE_TABLE                                            \
749   /* { name, min_len, max_len, decl_req, type_req, fn_type_req,              \
750        affects_type_identity, handler, exclude } */                          \
751   { "apple_kext_compatibility", 0, 0, false, true, false, false,             \
752     darwin_handle_kext_attribute, NULL },                                    \
753   { "weak_import", 0, 0, true, false, false, false,                          \
754     darwin_handle_weak_import_attribute, NULL }
755
756 /* Make local constant labels linker-visible, so that if one follows a
757    weak_global constant, ld64 will be able to separate the atoms.  */
758 #undef ASM_GENERATE_INTERNAL_LABEL
759 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)   \
760   do {                                                  \
761     if (strcmp ("LC", PREFIX) == 0)                     \
762       sprintf (LABEL, "*%s%ld", "lC", (long)(NUM));     \
763     else                                                \
764       sprintf (LABEL, "*%s%ld", PREFIX, (long)(NUM));   \
765   } while (0)
766
767 #undef TARGET_ASM_MARK_DECL_PRESERVED
768 #define TARGET_ASM_MARK_DECL_PRESERVED darwin_mark_decl_preserved
769
770 /* Set on a symbol with SYMBOL_FLAG_FUNCTION or
771    MACHO_SYMBOL_FLAG_VARIABLE to indicate that the function or
772    variable has been defined in this translation unit.
773    When porting Mach-O to new architectures you need to make
774    sure these aren't clobbered by the backend.  */
775
776 #define MACHO_SYMBOL_FLAG_VARIABLE (SYMBOL_FLAG_MACH_DEP)
777 #define MACHO_SYMBOL_FLAG_DEFINED ((SYMBOL_FLAG_MACH_DEP) << 1)
778
779 /* Set on a symbol to indicate when fix-and-continue style code
780    generation is being used and the symbol refers to a static symbol
781    that should be rebound from new instances of a translation unit to
782    the original instance of the data.  */
783
784 #define MACHO_SYMBOL_STATIC ((SYMBOL_FLAG_MACH_DEP) << 2)
785
786 /* Symbolic names for various things we might know about a symbol.  */
787
788 enum machopic_addr_class {
789   MACHOPIC_UNDEFINED,
790   MACHOPIC_DEFINED_DATA,
791   MACHOPIC_UNDEFINED_DATA,
792   MACHOPIC_DEFINED_FUNCTION,
793   MACHOPIC_UNDEFINED_FUNCTION
794 };
795
796 /* Macros defining the various PIC cases.  */
797
798 #undef  MACHO_DYNAMIC_NO_PIC_P
799 #define MACHO_DYNAMIC_NO_PIC_P  (TARGET_MACHO_DYNAMIC_NO_PIC)
800 #undef  MACHOPIC_INDIRECT
801 #define MACHOPIC_INDIRECT       (flag_pic || MACHO_DYNAMIC_NO_PIC_P)
802 #define MACHOPIC_JUST_INDIRECT  (MACHO_DYNAMIC_NO_PIC_P)
803 #undef  MACHOPIC_PURE
804 #define MACHOPIC_PURE           (flag_pic && ! MACHO_DYNAMIC_NO_PIC_P)
805
806 #undef TARGET_ENCODE_SECTION_INFO
807 #define TARGET_ENCODE_SECTION_INFO  darwin_encode_section_info
808 #undef TARGET_STRIP_NAME_ENCODING
809 #define TARGET_STRIP_NAME_ENCODING  default_strip_name_encoding
810
811 #define GEN_BINDER_NAME_FOR_STUB(BUF,STUB,STUB_LENGTH)          \
812   do {                                                          \
813     const char *const stub_ = (STUB);                           \
814     char *buffer_ = (BUF);                                      \
815     strcpy (buffer_, stub_);                                    \
816     if (stub_[0] == '"')                                        \
817       {                                                         \
818         strcpy (buffer_ + (STUB_LENGTH) - 1, "_binder\"");      \
819       }                                                         \
820     else                                                        \
821       {                                                         \
822         strcpy (buffer_ + (STUB_LENGTH), "_binder");            \
823       }                                                         \
824   } while (0)
825
826 #define GEN_SYMBOL_NAME_FOR_SYMBOL(BUF,SYMBOL,SYMBOL_LENGTH)    \
827   do {                                                          \
828     const char *const symbol_ = (SYMBOL);                       \
829     char *buffer_ = (BUF);                                      \
830     if (name_needs_quotes (symbol_) && symbol_[0] != '"')       \
831       {                                                         \
832           sprintf (buffer_, "\"%s\"", symbol_);                 \
833       }                                                         \
834     else                                                        \
835       {                                                         \
836         strcpy (buffer_, symbol_);                              \
837       }                                                         \
838   } while (0)
839
840 /* Given a symbol name string, create the lazy pointer version
841    of the symbol name.  */
842
843 #define GEN_LAZY_PTR_NAME_FOR_SYMBOL(BUF,SYMBOL,SYMBOL_LENGTH)  \
844   do {                                                          \
845     const char *symbol_ = (SYMBOL);                             \
846     char *buffer_ = (BUF);                                      \
847     if (symbol_[0] == '"')                                      \
848       {                                                         \
849         strcpy (buffer_, "\"L");                                \
850         strcpy (buffer_ + 2, symbol_ + 1);                      \
851         strcpy (buffer_ + (SYMBOL_LENGTH), "$lazy_ptr\"");      \
852       }                                                         \
853     else if (name_needs_quotes (symbol_))                       \
854       {                                                         \
855         strcpy (buffer_, "\"L");                                \
856         strcpy (buffer_ + 2, symbol_);                          \
857         strcpy (buffer_ + (SYMBOL_LENGTH) + 2, "$lazy_ptr\"");  \
858       }                                                         \
859     else                                                        \
860       {                                                         \
861         strcpy (buffer_, "L");                                  \
862         strcpy (buffer_ + 1, symbol_);                          \
863         strcpy (buffer_ + (SYMBOL_LENGTH) + 1, "$lazy_ptr");    \
864       }                                                         \
865   } while (0)
866
867 #define EH_FRAME_SECTION_NAME   "__TEXT"
868 #define EH_FRAME_SECTION_ATTR ",coalesced,no_toc+strip_static_syms+live_support"
869
870 #undef ASM_PREFERRED_EH_DATA_FORMAT
871 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)  \
872   (((CODE) == 2 && (GLOBAL) == 1) \
873    ? (DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4) : \
874      ((CODE) == 1 || (GLOBAL) == 0) ? DW_EH_PE_pcrel : DW_EH_PE_absptr)
875
876 #define ASM_OUTPUT_DWARF_DELTA(FILE,SIZE,LABEL1,LABEL2)  \
877   darwin_asm_output_dwarf_delta (FILE, SIZE, LABEL1, LABEL2, 0)
878
879 #define ASM_OUTPUT_DWARF_OFFSET(FILE,SIZE,LABEL,OFFSET,BASE)  \
880   darwin_asm_output_dwarf_offset (FILE, SIZE, LABEL, OFFSET, BASE)
881
882 #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(ASM_OUT_FILE, ENCODING, SIZE, ADDR, DONE)     \
883       if (ENCODING == ASM_PREFERRED_EH_DATA_FORMAT (2, 1)) {                            \
884         darwin_non_lazy_pcrel (ASM_OUT_FILE, ADDR);                                     \
885         goto DONE;                                                                      \
886       }
887
888 /* Experimentally, putting jump tables in text is faster on SPEC.
889    Also this is needed for correctness for coalesced functions.  */
890
891 #ifndef JUMP_TABLES_IN_TEXT_SECTION
892 #define JUMP_TABLES_IN_TEXT_SECTION 1
893 #endif
894
895 #define TARGET_TERMINATE_DW2_EH_FRAME_INFO false
896
897 #define TARGET_ASM_INIT_SECTIONS darwin_init_sections
898 #undef TARGET_ASM_NAMED_SECTION
899 #define TARGET_ASM_NAMED_SECTION darwin_asm_named_section
900
901 #define DARWIN_REGISTER_TARGET_PRAGMAS()                        \
902   do {                                                          \
903     if (!flag_preprocess_only)                                  \
904       cpp_register_pragma (parse_in, NULL, "mark",              \
905                            darwin_pragma_ignore, false);        \
906     c_register_pragma (0, "options", darwin_pragma_options);    \
907     c_register_pragma (0, "segment", darwin_pragma_ignore);     \
908     c_register_pragma (0, "unused", darwin_pragma_unused);      \
909     c_register_pragma (0, "ms_struct", darwin_pragma_ms_struct); \
910   } while (0)
911
912 #undef ASM_APP_ON
913 #define ASM_APP_ON ""
914 #undef ASM_APP_OFF
915 #define ASM_APP_OFF ""
916
917 void darwin_register_frameworks (const char *, const char *, int);
918 void darwin_register_objc_includes (const char *, const char *, int);
919 #define TARGET_EXTRA_PRE_INCLUDES darwin_register_objc_includes
920 #define TARGET_EXTRA_INCLUDES darwin_register_frameworks
921
922 void add_framework_path (char *);
923 #define TARGET_OPTF add_framework_path
924
925 #define TARGET_POSIX_IO
926
927 #define WINT_TYPE "int"
928
929 /* Every program on darwin links against libSystem which contains the pthread
930    routines, so there's no need to explicitly call out when doing threaded
931    work.  */
932
933 #undef GOMP_SELF_SPECS
934 #define GOMP_SELF_SPECS ""
935 #undef GTM_SELF_SPECS
936 #define GTM_SELF_SPECS ""
937
938 /* Darwin disables section anchors by default.  
939    They should be enabled per arch where support exists in that arch.  */
940 #define TARGET_ASM_OUTPUT_ANCHOR NULL
941 #define DARWIN_SECTION_ANCHORS 0
942
943 #define HAVE_ENABLE_EXECUTE_STACK
944
945 /* For Apple KEXTs, we make the constructors return this to match gcc
946    2.95.  */
947 #define TARGET_CXX_CDTOR_RETURNS_THIS (darwin_kextabi_p)
948 #define TARGET_KEXTABI flag_apple_kext
949
950 /* We have target-specific builtins.  */
951 #define SUBTARGET_FOLD_BUILTIN darwin_fold_builtin
952
953 #define TARGET_N_FORMAT_TYPES 1
954 #define TARGET_FORMAT_TYPES darwin_additional_format_types
955
956 #ifndef USED_FOR_TARGET
957 extern void darwin_driver_init (unsigned int *,struct cl_decoded_option **);
958 #define GCC_DRIVER_HOST_INITIALIZATION \
959   darwin_driver_init (&decoded_options_count, &decoded_options)
960 #endif
961
962 /* The Apple assembler and linker do not support constructor priorities.  */
963 #undef SUPPORTS_INIT_PRIORITY
964 #define SUPPORTS_INIT_PRIORITY 0
965
966 /* When building cross-compilers (and native crosses) we shall default to 
967    providing an osx-version-min of this unless overridden by the User.
968    10.5 is the only version that fully supports all our archs so that's the
969    fall-back default.  */
970 #define DEF_MIN_OSX_VERSION "10.5"
971
972 /* Later versions of ld64 support coalescing weak code/data without requiring
973    that they be placed in specially identified sections.  This is the earliest
974    _tested_ version known to support this so far.  */
975 #define MIN_LD64_NO_COAL_SECTS "236.4"
976
977 #ifndef LD64_VERSION
978 #define LD64_VERSION "85.2"
979 #else
980 #define DEF_LD64 LD64_VERSION
981 #endif
982
983 #endif /* CONFIG_DARWIN_H */