1 /* Darwin support needed only by C/C++ frontends.
2 Copyright (C) 2001-2015 Free Software Foundation, Inc.
3 Contributed by Apple Computer Inc.
5 This file is part of GCC.
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)
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.
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/>. */
23 #include "coretypes.h"
31 #include "c-family/c-common.h"
32 #include "c-family/c-pragma.h"
33 #include "c-family/c-format.h"
34 #include "diagnostic-core.h"
37 #include "cppdefault.h"
39 #include "c-family/c-target.h"
40 #include "c-family/c-target-def.h"
42 #include "dominance.h"
48 #include "cfgcleanup.h"
49 #include "basic-block.h"
50 #include "hard-reg-set.h"
53 #include "../../libcpp/internal.h"
57 #define BAD(gmsgid) do { warning (OPT_Wpragmas, gmsgid); return; } while (0)
58 #define BAD2(msgid, arg) do { warning (OPT_Wpragmas, msgid, arg); return; } while (0)
60 static bool using_frameworks
= false;
62 static const char *find_subframework_header (cpp_reader
*pfile
, const char *header
,
65 typedef struct align_stack
68 struct align_stack
* prev
;
71 static struct align_stack
* field_align_stack
= NULL
;
73 /* Maintain a small stack of alignments. This is similar to pragma
74 pack's stack, but simpler. */
77 push_field_alignment (int bit_alignment
)
79 align_stack
*entry
= XNEW (align_stack
);
81 entry
->alignment
= maximum_field_alignment
;
82 entry
->prev
= field_align_stack
;
83 field_align_stack
= entry
;
85 maximum_field_alignment
= bit_alignment
;
89 pop_field_alignment (void)
91 if (field_align_stack
)
93 align_stack
*entry
= field_align_stack
;
95 maximum_field_alignment
= entry
->alignment
;
96 field_align_stack
= entry
->prev
;
100 error ("too many #pragma options align=reset");
103 /* Handlers for Darwin-specific pragmas. */
106 darwin_pragma_ignore (cpp_reader
*pfile ATTRIBUTE_UNUSED
)
111 /* #pragma options align={mac68k|power|reset} */
114 darwin_pragma_options (cpp_reader
*pfile ATTRIBUTE_UNUSED
)
119 if (pragma_lex (&t
) != CPP_NAME
)
120 BAD ("malformed '#pragma options', ignoring");
121 arg
= IDENTIFIER_POINTER (t
);
122 if (strcmp (arg
, "align"))
123 BAD ("malformed '#pragma options', ignoring");
124 if (pragma_lex (&t
) != CPP_EQ
)
125 BAD ("malformed '#pragma options', ignoring");
126 if (pragma_lex (&t
) != CPP_NAME
)
127 BAD ("malformed '#pragma options', ignoring");
129 if (pragma_lex (&x
) != CPP_EOF
)
130 warning (OPT_Wpragmas
, "junk at end of '#pragma options'");
132 arg
= IDENTIFIER_POINTER (t
);
133 if (!strcmp (arg
, "mac68k"))
134 push_field_alignment (16);
135 else if (!strcmp (arg
, "power"))
136 push_field_alignment (0);
137 else if (!strcmp (arg
, "reset"))
138 pop_field_alignment ();
140 BAD ("malformed '#pragma options align={mac68k|power|reset}', ignoring");
143 /* #pragma unused ([var {, var}*]) */
146 darwin_pragma_unused (cpp_reader
*pfile ATTRIBUTE_UNUSED
)
151 if (pragma_lex (&x
) != CPP_OPEN_PAREN
)
152 BAD ("missing '(' after '#pragma unused', ignoring");
156 tok
= pragma_lex (&decl
);
157 if (tok
== CPP_NAME
&& decl
)
159 tree local
= lookup_name (decl
);
160 if (local
&& (TREE_CODE (local
) == PARM_DECL
161 || TREE_CODE (local
) == VAR_DECL
))
163 TREE_USED (local
) = 1;
164 DECL_READ_P (local
) = 1;
166 tok
= pragma_lex (&x
);
167 if (tok
!= CPP_COMMA
)
172 if (tok
!= CPP_CLOSE_PAREN
)
173 BAD ("missing ')' after '#pragma unused', ignoring");
175 if (pragma_lex (&x
) != CPP_EOF
)
176 BAD ("junk at end of '#pragma unused'");
179 /* Parse the ms_struct pragma. */
181 darwin_pragma_ms_struct (cpp_reader
*pfile ATTRIBUTE_UNUSED
)
186 if (pragma_lex (&t
) != CPP_NAME
)
187 BAD ("malformed '#pragma ms_struct', ignoring");
188 arg
= IDENTIFIER_POINTER (t
);
190 if (!strcmp (arg
, "on"))
191 darwin_ms_struct
= true;
192 else if (!strcmp (arg
, "off") || !strcmp (arg
, "reset"))
193 darwin_ms_struct
= false;
195 BAD ("malformed '#pragma ms_struct {on|off|reset}', ignoring");
197 if (pragma_lex (&t
) != CPP_EOF
)
198 BAD ("junk at end of '#pragma ms_struct'");
201 static struct frameworks_in_use
{
205 } *frameworks_in_use
;
206 static int num_frameworks
= 0;
207 static int max_frameworks
= 0;
210 /* Remember which frameworks have been seen, so that we can ensure
211 that all uses of that framework come from the same framework. DIR
212 is the place where the named framework NAME, which is of length
213 LEN, was found. We copy the directory name from NAME, as it will be
217 add_framework (const char *name
, size_t len
, cpp_dir
*dir
)
221 for (i
= 0; i
< num_frameworks
; ++i
)
223 if (len
== frameworks_in_use
[i
].len
224 && strncmp (name
, frameworks_in_use
[i
].name
, len
) == 0)
229 if (i
>= max_frameworks
)
231 max_frameworks
= i
*2;
232 max_frameworks
+= i
== 0;
233 frameworks_in_use
= XRESIZEVEC (struct frameworks_in_use
,
234 frameworks_in_use
, max_frameworks
);
236 dir_name
= XNEWVEC (char, len
+ 1);
237 memcpy (dir_name
, name
, len
);
238 dir_name
[len
] = '\0';
239 frameworks_in_use
[num_frameworks
].name
= dir_name
;
240 frameworks_in_use
[num_frameworks
].len
= len
;
241 frameworks_in_use
[num_frameworks
].dir
= dir
;
245 /* Recall if we have seen the named framework NAME, before, and where
246 we saw it. NAME is LEN bytes long. The return value is the place
247 where it was seen before. */
249 static struct cpp_dir
*
250 find_framework (const char *name
, size_t len
)
253 for (i
= 0; i
< num_frameworks
; ++i
)
255 if (len
== frameworks_in_use
[i
].len
256 && strncmp (name
, frameworks_in_use
[i
].name
, len
) == 0)
258 return frameworks_in_use
[i
].dir
;
264 /* There are two directories in a framework that contain header files,
265 Headers and PrivateHeaders. We search Headers first as it is more
266 common to upgrade a header from PrivateHeaders to Headers and when
267 that is done, the old one might hang around and be out of data,
270 struct framework_header
{const char * dirName
; int dirNameLen
; };
271 static struct framework_header framework_header_dirs
[] = {
273 { "PrivateHeaders", 14 },
277 /* Returns a pointer to a malloced string that contains the real pathname
278 to the file, given the base name and the name. */
281 framework_construct_pathname (const char *fname
, cpp_dir
*dir
)
284 size_t fname_len
, frname_len
;
290 /* Framework names must have a / in them. */
291 buf
= strchr (fname
, '/');
293 fname_len
= buf
- fname
;
297 fast_dir
= find_framework (fname
, fname_len
);
299 /* Framework includes must all come from one framework. */
300 if (fast_dir
&& dir
!= fast_dir
)
303 frname
= XNEWVEC (char, strlen (fname
) + dir
->len
+ 2
304 + strlen(".framework/") + strlen("PrivateHeaders"));
305 strncpy (&frname
[0], dir
->name
, dir
->len
);
306 frname_len
= dir
->len
;
307 if (frname_len
&& frname
[frname_len
-1] != '/')
308 frname
[frname_len
++] = '/';
309 strncpy (&frname
[frname_len
], fname
, fname_len
);
310 frname_len
+= fname_len
;
311 strncpy (&frname
[frname_len
], ".framework/", strlen (".framework/"));
312 frname_len
+= strlen (".framework/");
316 frname
[frname_len
-1] = 0;
317 if (stat (frname
, &st
) == 0)
319 /* As soon as we find the first instance of the framework,
320 we stop and never use any later instance of that
322 add_framework (fname
, fname_len
, dir
);
326 /* If we can't find the parent directory, no point looking
331 frname
[frname_len
-1] = '/';
334 /* Append framework_header_dirs and header file name */
335 for (i
= 0; framework_header_dirs
[i
].dirName
; i
++)
337 strncpy (&frname
[frname_len
],
338 framework_header_dirs
[i
].dirName
,
339 framework_header_dirs
[i
].dirNameLen
);
340 strcpy (&frname
[frname_len
+ framework_header_dirs
[i
].dirNameLen
],
343 if (stat (frname
, &st
) == 0)
351 /* Search for FNAME in sub-frameworks. pname is the context that we
352 wish to search in. Return the path the file was found at,
353 otherwise return 0. */
356 find_subframework_file (const char *fname
, const char *pname
)
359 const char *dot_framework
= ".framework/";
361 int sfrname_len
, i
, fname_len
;
362 struct cpp_dir
*fast_dir
;
363 static struct cpp_dir subframe_dir
;
366 bufptr
= strchr (fname
, '/');
368 /* Subframework files must have / in the name. */
372 fname_len
= bufptr
- fname
;
373 fast_dir
= find_framework (fname
, fname_len
);
375 /* Sub framework header filename includes parent framework name and
376 header name in the "CarbonCore/OSUtils.h" form. If it does not
377 include slash it is not a sub framework include. */
378 bufptr
= strstr (pname
, dot_framework
);
380 /* If the parent header is not of any framework, then this header
381 cannot be part of any subframework. */
385 /* Now translate. For example, +- bufptr
386 fname = CarbonCore/OSUtils.h |
387 pname = /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h
389 sfrname = /System/Library/Frameworks/Foundation.framework/Frameworks/CarbonCore.framework/Headers/OSUtils.h */
391 sfrname
= XNEWVEC (char, strlen (pname
) + strlen (fname
) + 2 +
392 strlen ("Frameworks/") + strlen (".framework/")
393 + strlen ("PrivateHeaders"));
395 bufptr
+= strlen (dot_framework
);
397 sfrname_len
= bufptr
- pname
;
399 strncpy (&sfrname
[0], pname
, sfrname_len
);
401 strncpy (&sfrname
[sfrname_len
], "Frameworks/", strlen ("Frameworks/"));
402 sfrname_len
+= strlen("Frameworks/");
404 strncpy (&sfrname
[sfrname_len
], fname
, fname_len
);
405 sfrname_len
+= fname_len
;
407 strncpy (&sfrname
[sfrname_len
], ".framework/", strlen (".framework/"));
408 sfrname_len
+= strlen (".framework/");
410 /* Append framework_header_dirs and header file name */
411 for (i
= 0; framework_header_dirs
[i
].dirName
; i
++)
413 strncpy (&sfrname
[sfrname_len
],
414 framework_header_dirs
[i
].dirName
,
415 framework_header_dirs
[i
].dirNameLen
);
416 strcpy (&sfrname
[sfrname_len
+ framework_header_dirs
[i
].dirNameLen
],
419 if (stat (sfrname
, &st
) == 0)
421 if (fast_dir
!= &subframe_dir
)
424 warning (0, "subframework include %s conflicts with framework include",
427 add_framework (fname
, fname_len
, &subframe_dir
);
438 /* Add PATH to the system includes. PATH must be malloc-ed and
439 NUL-terminated. System framework paths are C++ aware. */
442 add_system_framework_path (char *path
)
450 p
->sysp
= 1 + !cxx_aware
;
451 p
->construct
= framework_construct_pathname
;
452 using_frameworks
= 1;
454 add_cpp_dir_path (p
, SYSTEM
);
457 /* Add PATH to the bracket includes. PATH must be malloc-ed and
461 add_framework_path (char *path
)
469 p
->construct
= framework_construct_pathname
;
470 using_frameworks
= 1;
472 add_cpp_dir_path (p
, BRACKET
);
475 static const char *framework_defaults
[] =
477 "/System/Library/Frameworks",
478 "/Library/Frameworks",
481 /* Register the GNU objective-C runtime include path if STDINC. */
484 darwin_register_objc_includes (const char *sysroot
, const char *iprefix
,
489 /* We do not do anything if we do not want the standard includes. */
493 fname
= GCC_INCLUDE_DIR
"-gnu-runtime";
495 /* Register the GNU OBJC runtime include path if we are compiling OBJC
498 if (c_dialect_objc () && !flag_next_runtime
)
501 /* See if our directory starts with the standard prefix.
502 "Translate" them, i.e. replace /usr/local/lib/gcc... with
503 IPREFIX and search them first. */
504 if (iprefix
&& (len
= cpp_GCC_INCLUDE_DIR_len
) != 0 && !sysroot
505 && !strncmp (fname
, cpp_GCC_INCLUDE_DIR
, len
))
507 str
= concat (iprefix
, fname
+ len
, NULL
);
508 /* FIXME: wrap the headers for C++awareness. */
509 add_path (str
, SYSTEM
, /*c++aware=*/false, false);
512 /* Should this directory start with the sysroot? */
514 str
= concat (sysroot
, fname
, NULL
);
516 str
= update_path (fname
, "");
518 add_path (str
, SYSTEM
, /*c++aware=*/false, false);
523 /* Register all the system framework paths if STDINC is true and setup
524 the missing_header callback for subframework searching if any
525 frameworks had been registered. */
528 darwin_register_frameworks (const char *sysroot
,
529 const char *iprefix ATTRIBUTE_UNUSED
, int stdinc
)
535 /* Setup default search path for frameworks. */
536 for (i
=0; i
<sizeof (framework_defaults
)/sizeof(const char *); ++i
)
540 str
= concat (sysroot
, xstrdup (framework_defaults
[i
]), NULL
);
542 str
= xstrdup (framework_defaults
[i
]);
543 /* System Framework headers are cxx aware. */
544 add_system_framework_path (str
);
548 if (using_frameworks
)
549 cpp_get_callbacks (parse_in
)->missing_header
= find_subframework_header
;
552 /* Search for HEADER in context dependent way. The return value is
553 the malloced name of a header to try and open, if any, or NULL
554 otherwise. This is called after normal header lookup processing
555 fails to find a header. We search each file in the include stack,
556 using FUNC, starting from the most deeply nested include and
557 finishing with the main input file. We stop searching when FUNC
561 find_subframework_header (cpp_reader
*pfile
, const char *header
, cpp_dir
**dirp
)
563 const char *fname
= header
;
564 struct cpp_buffer
*b
;
567 for (b
= cpp_get_buffer (pfile
);
568 b
&& cpp_get_file (b
) && cpp_get_path (cpp_get_file (b
));
569 b
= cpp_get_prev (b
))
571 n
= find_subframework_file (fname
, cpp_get_path (cpp_get_file (b
)));
574 /* Logically, the place where we found the subframework is
575 the place where we found the Framework that contains the
576 subframework. This is useful for tracking wether or not
577 we are in a system header. */
578 *dirp
= cpp_get_dir (cpp_get_file (b
));
586 /* Given an OS X version VERSION_STR, return it as a statically-allocated array
587 of three integers. If VERSION_STR is invalid, return NULL.
589 VERSION_STR must consist of one, two, or three tokens, each separated by
590 a single period. Each token must contain only the characters '0' through
591 '9' and is converted to an equivalent non-negative decimal integer. Omitted
592 tokens become zeros. For example:
594 "10" becomes {10,0,0}
595 "10.10" becomes {10,10,0}
596 "10.10.1" becomes {10,10,1}
597 "10.000010.1" becomes {10,10,1}
598 "10.010.001" becomes {10,10,1}
599 "000010.10.00001" becomes {10,10,1}
602 "10.10." is invalid */
604 enum version_components
{ MAJOR
, MINOR
, TINY
};
606 static const unsigned long *
607 parse_version (const char *version_str
)
611 static unsigned long version_array
[3];
613 version_len
= strlen (version_str
);
617 /* Version string must consist of digits and periods only. */
618 if (strspn (version_str
, "0123456789.") != version_len
)
621 if (!ISDIGIT (version_str
[0]) || !ISDIGIT (version_str
[version_len
- 1]))
624 version_array
[MAJOR
] = strtoul (version_str
, &end
, 10);
625 version_str
= end
+ ((*end
== '.') ? 1 : 0);
627 /* Version string must not contain adjacent periods. */
628 if (*version_str
== '.')
631 version_array
[MINOR
] = strtoul (version_str
, &end
, 10);
632 version_str
= end
+ ((*end
== '.') ? 1 : 0);
634 version_array
[TINY
] = strtoul (version_str
, &end
, 10);
636 /* Version string must contain no more than three tokens. */
640 return version_array
;
643 /* Given VERSION -- a three-component OS X version represented as an array of
644 non-negative integers -- return a statically-allocated string suitable for
645 the legacy __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro. If VERSION
646 is invalid and cannot be coerced into a valid form, return NULL.
648 The legacy format is a four-character string -- two chars for the major
649 number and one each for the minor and tiny numbers. Minor and tiny numbers
650 from 10 through 99 are permitted but are clamped to 9 (for example, {10,9,10}
651 produces "1099"). If VERSION contains numbers greater than 99, it is
655 version_as_legacy_macro (const unsigned long *version
)
657 unsigned long major
, minor
, tiny
;
658 static char result
[5];
660 major
= version
[MAJOR
];
661 minor
= version
[MINOR
];
662 tiny
= version
[TINY
];
664 if (major
> 99 || minor
> 99 || tiny
> 99)
667 minor
= ((minor
> 9) ? 9 : minor
);
668 tiny
= ((tiny
> 9) ? 9 : tiny
);
670 if (sprintf (result
, "%lu%lu%lu", major
, minor
, tiny
) != 4)
676 /* Given VERSION -- a three-component OS X version represented as an array of
677 non-negative integers -- return a statically-allocated string suitable for
678 the modern __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro. If VERSION
679 is invalid, return NULL.
681 The modern format is a six-character string -- two chars for each component,
682 with zero-padding if necessary (for example, {10,10,1} produces "101001"). If
683 VERSION contains numbers greater than 99, it is rejected. */
686 version_as_modern_macro (const unsigned long *version
)
688 unsigned long major
, minor
, tiny
;
689 static char result
[7];
691 major
= version
[MAJOR
];
692 minor
= version
[MINOR
];
693 tiny
= version
[TINY
];
695 if (major
> 99 || minor
> 99 || tiny
> 99)
698 if (sprintf (result
, "%02lu%02lu%02lu", major
, minor
, tiny
) != 6)
704 /* Return the value of darwin_macosx_version_min, suitably formatted for the
705 __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro. Values representing
706 OS X 10.9 and earlier are encoded using the legacy four-character format,
707 while 10.10 and later use a modern six-character format. (For example,
708 "10.9" produces "1090", and "10.10.1" produces "101001".) If
709 darwin_macosx_version_min is invalid and cannot be coerced into a valid
710 form, print a warning and return "1000". */
713 macosx_version_as_macro (void)
715 const unsigned long *version_array
;
716 const char *version_macro
;
718 version_array
= parse_version (darwin_macosx_version_min
);
722 if (version_array
[MAJOR
] != 10)
725 if (version_array
[MINOR
] < 10)
726 version_macro
= version_as_legacy_macro (version_array
);
728 version_macro
= version_as_modern_macro (version_array
);
733 return version_macro
;
736 error ("unknown value %qs of -mmacosx-version-min",
737 darwin_macosx_version_min
);
741 /* Define additional CPP flags for Darwin. */
743 #define builtin_define(TXT) cpp_define (pfile, TXT)
746 darwin_cpp_builtins (cpp_reader
*pfile
)
748 builtin_define ("__MACH__");
749 builtin_define ("__APPLE__");
751 /* __APPLE_CC__ is defined as some old Apple include files expect it
752 to be defined and won't work if it isn't. */
753 builtin_define_with_value ("__APPLE_CC__", "1", false);
755 if (darwin_constant_cfstrings
)
756 builtin_define ("__CONSTANT_CFSTRINGS__");
758 builtin_define_with_value ("__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__",
759 macosx_version_as_macro(), false);
761 /* Since we do not (at 4.6) support ObjC gc for the NeXT runtime, the
762 following will cause a syntax error if one tries to compile gc attributed
763 items. However, without this, NeXT system headers cannot be parsed
764 properly (on systems >= darwin 9). */
767 builtin_define ("__strong=__attribute__((objc_gc(strong)))");
768 builtin_define ("__weak=__attribute__((objc_gc(weak)))");
769 builtin_define ("__OBJC_GC__");
773 builtin_define ("__strong=");
774 builtin_define ("__weak=");
777 if (CPP_OPTION (pfile
, objc
) && flag_objc_abi
== 2)
778 builtin_define ("__OBJC2__");
781 /* Handle C family front-end options. */
784 handle_c_option (size_t code
,
786 int value ATTRIBUTE_UNUSED
)
791 /* Unrecognized options that we said we'd handle turn into
792 errors if not listed here. */
796 add_system_framework_path (xstrdup (arg
));
799 case OPT_fapple_kext
:
803 /* We recognized the option. */
807 /* Allow ObjC* access to CFStrings. */
809 darwin_objc_construct_string (tree str
)
811 if (!darwin_constant_cfstrings
)
813 /* Even though we are not using CFStrings, place our literal
814 into the cfstring_htab hash table, so that the
815 darwin_constant_cfstring_p() function will see it. */
816 darwin_enter_string_into_cfstring_table (str
);
817 /* Fall back to NSConstantString. */
821 return darwin_build_constant_cfstring (str
);
824 /* The string ref type is created as CFStringRef by <CFBase.h> therefore, we
825 must match for it explicitly, since it's outside the gcc code. */
828 darwin_cfstring_ref_p (const_tree strp
)
831 if (!strp
|| TREE_CODE (strp
) != POINTER_TYPE
)
834 tn
= TYPE_NAME (strp
);
838 && IDENTIFIER_POINTER (tn
)
839 && !strncmp (IDENTIFIER_POINTER (tn
), "CFStringRef", 8));
842 /* At present the behavior of this is undefined and it does nothing. */
844 darwin_check_cfstring_format_arg (tree
ARG_UNUSED (format_arg
),
845 tree
ARG_UNUSED (args_list
))
849 /* The extra format types we recognize. */
850 EXPORTED_CONST format_kind_info darwin_additional_format_types
[] = {
851 { "CFString", NULL
, NULL
, NULL
, NULL
,
853 FMT_FLAG_ARG_CONVERT
|FMT_FLAG_PARSE_ARG_CONVERT_EXTERNAL
, 0, 0, 0, 0, 0, 0,
859 /* Support routines to dump the class references for NeXT ABI v1, aka
860 32-bits ObjC-2.0, as top-level asms.
861 The following two functions should only be called from
862 objc/objc-next-runtime-abi-01.c. */
865 darwin_objc_declare_unresolved_class_reference (const char *name
)
867 const char *lazy_reference
= ".lazy_reference\t";
868 const char *hard_reference
= ".reference\t";
869 const char *reference
= MACHOPIC_INDIRECT
? lazy_reference
: hard_reference
;
870 size_t len
= strlen (reference
) + strlen(name
) + 2;
871 char *buf
= (char *) alloca (len
);
873 gcc_checking_assert (!strncmp (name
, ".objc_class_name_", 17));
875 snprintf (buf
, len
, "%s%s", reference
, name
);
876 symtab
->finalize_toplevel_asm (build_string (strlen (buf
), buf
));
880 darwin_objc_declare_class_definition (const char *name
)
882 const char *xname
= targetm
.strip_name_encoding (name
);
883 size_t len
= strlen (xname
) + 7 + 5;
884 char *buf
= (char *) alloca (len
);
886 gcc_checking_assert (!strncmp (name
, ".objc_class_name_", 17)
887 || !strncmp (name
, "*.objc_category_name_", 21));
889 /* Mimic default_globalize_label. */
890 snprintf (buf
, len
, ".globl\t%s", xname
);
891 symtab
->finalize_toplevel_asm (build_string (strlen (buf
), buf
));
893 snprintf (buf
, len
, "%s = 0", xname
);
894 symtab
->finalize_toplevel_asm (build_string (strlen (buf
), buf
));
897 #undef TARGET_HANDLE_C_OPTION
898 #define TARGET_HANDLE_C_OPTION handle_c_option
900 #undef TARGET_OBJC_CONSTRUCT_STRING_OBJECT
901 #define TARGET_OBJC_CONSTRUCT_STRING_OBJECT darwin_objc_construct_string
903 #undef TARGET_OBJC_DECLARE_UNRESOLVED_CLASS_REFERENCE
904 #define TARGET_OBJC_DECLARE_UNRESOLVED_CLASS_REFERENCE \
905 darwin_objc_declare_unresolved_class_reference
907 #undef TARGET_OBJC_DECLARE_CLASS_DEFINITION
908 #define TARGET_OBJC_DECLARE_CLASS_DEFINITION \
909 darwin_objc_declare_class_definition
911 #undef TARGET_STRING_OBJECT_REF_TYPE_P
912 #define TARGET_STRING_OBJECT_REF_TYPE_P darwin_cfstring_ref_p
914 #undef TARGET_CHECK_STRING_OBJECT_FORMAT_ARG
915 #define TARGET_CHECK_STRING_OBJECT_FORMAT_ARG darwin_check_cfstring_format_arg
917 struct gcc_targetcm targetcm
= TARGETCM_INITIALIZER
;