OSDN Git Service

* config/h8300/h8300.h (N_REG_CLASSES): Parenthesize.
[pf3gnuchains/gcc-fork.git] / gcc / config / darwin.h
1 /* Target definitions for Darwin (Mac OS X) systems.
2    Copyright (C) 1989, 1990, 1991, 1992, 1993, 2000, 2001, 2002
3    Free Software Foundation, Inc.
4    Contributed by Apple Computer Inc.
5
6 This file is part of GNU CC.
7
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING.  If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.  */
22
23 /* The definitions in this file are common to all processor types
24    running Darwin, which is the kernel for Mac OS X.  Darwin is
25    basically a BSD user layer laid over a Mach kernel, then evolved
26    for many years (at NeXT) in parallel with other Unix systems.  So
27    while the runtime is a somewhat idiosyncratic Mach-based thing,
28    other definitions look like they would for a BSD variant.  */
29
30 /* Although NeXT ran on many different architectures, as of Jan 2001
31    the only supported Darwin targets are PowerPC and x86.  */
32
33 /* Technically, STANDARD_EXEC_PREFIX should be /usr/libexec/, but in
34    practice this makes it hard to install new compilers elsewhere, so
35    leave it undefined and expect system builders to set configure args
36    correctly.  */
37
38 /* One of Darwin's NeXT legacies is the Mach-O format, which is partly
39    like a.out and partly like COFF, with additional features like
40    multi-architecture binary support.  */
41
42 #define OBJECT_FORMAT_MACHO
43
44 /* Suppress g++ attempt to link in the math library automatically.
45    (Some Darwin versions have a libm, but they seem to cause problems
46    for C++ executables.)  */
47
48 #define MATH_LIBRARY ""
49
50 /* We have atexit.  */
51
52 #define HAVE_ATEXIT
53
54 /* Define an empty body for the function do_global_dtors() in libgcc2.c.  */
55
56 #define DO_GLOBAL_DTORS_BODY
57
58 /* The string value for __SIZE_TYPE__.  */
59
60 #ifndef SIZE_TYPE
61 #define SIZE_TYPE "long unsigned int"
62 #endif
63
64 /* Type used for ptrdiff_t, as a string used in a declaration.  */
65
66 #undef  PTRDIFF_TYPE
67 #define PTRDIFF_TYPE "int"
68
69 /* wchar_t is int.  */
70
71 #undef  WCHAR_TYPE
72 #define WCHAR_TYPE "int"
73 #undef  WCHAR_TYPE_SIZE
74 #define WCHAR_TYPE_SIZE 32
75
76 /* Default to using the NeXT-style runtime, since that's what is
77    pre-installed on Darwin systems.  */
78
79 #define NEXT_OBJC_RUNTIME
80
81 /* Don't default to pcc-struct-return, because gcc is the only compiler, and
82    we want to retain compatibility with older gcc versions.  */
83
84 #undef  DEFAULT_PCC_STRUCT_RETURN
85 #define DEFAULT_PCC_STRUCT_RETURN 0
86
87 /* Machine dependent cpp options.  */
88
89 #undef  CPP_SPEC
90 #define CPP_SPEC "%{static:-D__STATIC__}%{!static:-D__DYNAMIC__}"
91
92 /* Machine dependent libraries.  */
93
94 #undef  LIB_SPEC
95 #define LIB_SPEC "%{!static:-lSystem}"
96
97 /* We specify crt0.o as -lcrt0.o so that ld will search the library path.  */
98
99 #undef  STARTFILE_SPEC
100 #define STARTFILE_SPEC  \
101   "%{pg:%{static:-lgcrt0.o}%{!static:-lgcrt1.o -lcrtbegin.o}} \
102     %{!pg:%{static:-lcrt0.o}%{!static:-lcrt1.o -lcrtbegin.o}}"
103
104 #undef  ENDFILE_SPEC
105 #define ENDFILE_SPEC \
106   "-lcrtend.o"
107
108 #undef  DOLLARS_IN_IDENTIFIERS
109 #define DOLLARS_IN_IDENTIFIERS 2
110
111 /* We use Dbx symbol format.  */
112
113 #define DBX_DEBUGGING_INFO 1
114
115 /* When generating stabs debugging, use N_BINCL entries.  */
116
117 #define DBX_USE_BINCL
118
119 /* There is no limit to the length of stabs strings.  */
120
121 #define DBX_CONTIN_LENGTH 0
122
123 /* gdb needs a null N_SO at the end of each file for scattered loading.  */
124
125 #undef  DBX_OUTPUT_MAIN_SOURCE_FILE_END
126 #define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME)                 \
127 do { text_section ();                                                   \
128      fprintf (FILE,                                                     \
129               "\t.stabs \"%s\",%d,0,0,Letext\nLetext:\n", "" , N_SO);   \
130    } while (0)
131
132 /* Our profiling scheme doesn't LP labels and counter words.  */
133
134 #define NO_PROFILE_COUNTERS
135
136 #undef  INIT_SECTION_ASM_OP
137 #define INIT_SECTION_ASM_OP
138
139 #undef  INVOKE__main
140
141 #define TARGET_ASM_CONSTRUCTOR  machopic_asm_out_constructor
142 #define TARGET_ASM_DESTRUCTOR   machopic_asm_out_destructor
143
144 /* Always prefix with an underscore.  */
145
146 #define USER_LABEL_PREFIX "_"
147
148 /* Don't output a .file directive.  That is only used by the assembler for
149    error reporting.  */
150
151 #undef  ASM_FILE_START
152 #define ASM_FILE_START(FILE)
153
154 #undef  ASM_FILE_END
155 #define ASM_FILE_END(FILE)                                      \
156   do {                                                          \
157     machopic_finish (asm_out_file);                             \
158     if (strcmp (lang_hooks.name, "GNU C++") == 0)               \
159       {                                                         \
160         constructor_section ();                                 \
161         destructor_section ();                                  \
162         ASM_OUTPUT_ALIGN (FILE, 1);                             \
163       }                                                         \
164   } while (0)
165
166 #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
167   fprintf (FILE, "\t.space %d\n", SIZE)
168
169 /* Give ObjC methods pretty symbol names.  */
170
171 #undef  OBJC_GEN_METHOD_LABEL
172 #define OBJC_GEN_METHOD_LABEL(BUF,IS_INST,CLASS_NAME,CAT_NAME,SEL_NAME,NUM) \
173   do { if (CAT_NAME)                                                    \
174          sprintf (BUF, "%c[%s(%s) %s]", (IS_INST) ? '-' : '+',          \
175                   (CLASS_NAME), (CAT_NAME), (SEL_NAME));                \
176        else                                                             \
177          sprintf (BUF, "%c[%s %s]", (IS_INST) ? '-' : '+',              \
178                   (CLASS_NAME), (SEL_NAME));                            \
179      } while (0)
180
181 /* The RTTI data (e.g., __ti4name) is common and public (and static),
182    but it does need to be referenced via indirect PIC data pointers.
183    The machopic_define_name calls are telling the machopic subsystem
184    that the name *is* defined in this module, so it doesn't need to
185    make them indirect.  */
186
187 #undef ASM_DECLARE_OBJECT_NAME
188 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)                       \
189   do {                                                                  \
190     const char *xname = NAME;                                           \
191     if (GET_CODE (XEXP (DECL_RTL (DECL), 0)) != SYMBOL_REF)             \
192       xname = IDENTIFIER_POINTER (DECL_NAME (DECL));                    \
193     if ((TREE_STATIC (DECL)                                             \
194          && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL)))               \
195         || DECL_INITIAL (DECL))                                         \
196       machopic_define_name (xname);                                     \
197     if ((TREE_STATIC (DECL)                                             \
198          && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL)))               \
199         || DECL_INITIAL (DECL))                                         \
200       (* targetm.encode_section_info) (DECL, false);                    \
201     ASM_OUTPUT_LABEL (FILE, xname);                                     \
202   } while (0)
203
204 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)                     \
205   do {                                                                  \
206     const char *xname = NAME;                                           \
207     if (GET_CODE (XEXP (DECL_RTL (DECL), 0)) != SYMBOL_REF)             \
208       xname = IDENTIFIER_POINTER (DECL_NAME (DECL));                    \
209     if ((TREE_STATIC (DECL)                                             \
210          && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL)))               \
211         || DECL_INITIAL (DECL))                                         \
212       machopic_define_name (xname);                                     \
213     if ((TREE_STATIC (DECL)                                             \
214          && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL)))               \
215         || DECL_INITIAL (DECL))                                         \
216       (* targetm.encode_section_info) (DECL, false);                    \
217     ASM_OUTPUT_LABEL (FILE, xname);                                     \
218     /* Avoid generating stubs for functions we've just defined by       \
219        outputting any required stub name label now.  */                 \
220     machopic_output_possible_stub_label (FILE, xname);                  \
221   } while (0)
222
223 /* Wrap new method names in quotes so the assembler doesn't gag.
224    Make Objective-C internal symbols local.  */
225
226 #undef  ASM_OUTPUT_LABELREF
227 #define ASM_OUTPUT_LABELREF(FILE,NAME)                                       \
228   do {                                                                       \
229        const char *xname = darwin_strip_name_encoding (NAME);                \
230        if (xname[0] == '&' || xname[0] == '*')                               \
231          {                                                                   \
232            int len = strlen (xname);                                         \
233            if (len > 6 && !strcmp ("$stub", xname + len - 5))                \
234              machopic_validate_stub_or_non_lazy_ptr (xname, 1);              \
235            else if (len > 7 && !strcmp ("$stub\"", xname + len - 6))         \
236              machopic_validate_stub_or_non_lazy_ptr (xname, 1);              \
237            else if (len > 14 && !strcmp ("$non_lazy_ptr", xname + len - 13)) \
238              machopic_validate_stub_or_non_lazy_ptr (xname, 0);              \
239            fputs (&xname[1], FILE);                                          \
240          }                                                                   \
241        else if (xname[0] == '+' || xname[0] == '-')                          \
242          fprintf (FILE, "\"%s\"", xname);                                    \
243        else if (!strncmp (xname, "_OBJC_", 6))                               \
244          fprintf (FILE, "L%s", xname);                                       \
245        else if (!strncmp (xname, ".objc_class_name_", 17))                   \
246          fprintf (FILE, "%s", xname);                                        \
247        else                                                                  \
248          fprintf (FILE, "_%s", xname);                                       \
249   } while (0)
250
251 /* Output before executable code.  */
252 #undef TEXT_SECTION_ASM_OP
253 #define TEXT_SECTION_ASM_OP ".text"
254
255 /* Output before writable data.  */
256
257 #undef DATA_SECTION_ASM_OP
258 #define DATA_SECTION_ASM_OP ".data"
259
260 #undef  ALIGN_ASM_OP
261 #define ALIGN_ASM_OP            ".align"
262
263 #undef  ASM_OUTPUT_ALIGN
264 #define ASM_OUTPUT_ALIGN(FILE,LOG)      \
265   if ((LOG) != 0)                       \
266     fprintf (FILE, "\t%s %d\n", ALIGN_ASM_OP, (LOG))
267
268 /* Ensure correct alignment of bss data.  */
269
270 #undef  ASM_OUTPUT_ALIGNED_DECL_LOCAL
271 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN)    \
272   do {                                                                  \
273     fputs (".lcomm ", (FILE));                                          \
274     assemble_name ((FILE), (NAME));                                     \
275     fprintf ((FILE), ",%u,%u\n", (SIZE),                                \
276              floor_log2 ((ALIGN) / BITS_PER_UNIT));                     \
277     if ((DECL) && ((TREE_STATIC (DECL)                                  \
278          && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL)))               \
279         || DECL_INITIAL (DECL)))                                        \
280       (* targetm.encode_section_info) (DECL, false);                    \
281     if ((DECL) && ((TREE_STATIC (DECL)                                  \
282          && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL)))               \
283         || DECL_INITIAL (DECL)))                                        \
284       machopic_define_name (NAME);                                      \
285   } while (0)
286
287 /* The maximum alignment which the object file format can support.
288    For Mach-O, this is 2^15.  */
289
290 #undef  MAX_OFILE_ALIGNMENT
291 #define MAX_OFILE_ALIGNMENT 0x8000
292
293 /* Create new Mach-O sections.  */
294
295 #undef  SECTION_FUNCTION
296 #define SECTION_FUNCTION(FUNCTION, SECTION, DIRECTIVE, OBJC)            \
297 extern void FUNCTION PARAMS ((void));                                   \
298 void                                                                    \
299 FUNCTION ()                                                             \
300 {                                                                       \
301   if (in_section != SECTION)                                            \
302     {                                                                   \
303       if (OBJC)                                                         \
304         objc_section_init ();                                           \
305       data_section ();                                                  \
306       if (asm_out_file)                                                 \
307         fprintf (asm_out_file, "%s\n", DIRECTIVE);                      \
308       in_section = SECTION;                                             \
309     }                                                                   \
310 }                                                                       \
311
312 /* Darwin uses many types of special sections.  */
313
314 #undef  EXTRA_SECTIONS
315 #define EXTRA_SECTIONS                                  \
316   in_const, in_const_data, in_cstring, in_literal4, in_literal8,        \
317   in_constructor, in_destructor, in_mod_init, in_mod_term,              \
318   in_objc_class, in_objc_meta_class, in_objc_category,  \
319   in_objc_class_vars, in_objc_instance_vars,            \
320   in_objc_cls_meth, in_objc_inst_meth,                  \
321   in_objc_cat_cls_meth, in_objc_cat_inst_meth,          \
322   in_objc_selector_refs,                                \
323   in_objc_selector_fixup,                               \
324   in_objc_symbols, in_objc_module_info,                 \
325   in_objc_protocol, in_objc_string_object,              \
326   in_objc_constant_string_object,                       \
327   in_objc_class_names, in_objc_meth_var_names,          \
328   in_objc_meth_var_types, in_objc_cls_refs,             \
329   in_machopic_nl_symbol_ptr,                            \
330   in_machopic_lazy_symbol_ptr,                          \
331   in_machopic_symbol_stub,                              \
332   in_machopic_picsymbol_stub,                           \
333   in_darwin_exception, in_darwin_eh_frame,              \
334   num_sections
335
336 #undef  EXTRA_SECTION_FUNCTIONS
337 #define EXTRA_SECTION_FUNCTIONS                 \
338 static void objc_section_init PARAMS ((void));  \
339 SECTION_FUNCTION (const_section,                \
340                   in_const,                     \
341                   ".const", 0)                  \
342 SECTION_FUNCTION (const_data_section,           \
343                   in_const_data,                \
344                   ".const_data", 0)             \
345 SECTION_FUNCTION (cstring_section,              \
346                   in_cstring,                   \
347                   ".cstring", 0)                \
348 SECTION_FUNCTION (literal4_section,             \
349                   in_literal4,                  \
350                   ".literal4", 0)               \
351 SECTION_FUNCTION (literal8_section,             \
352                   in_literal8,                  \
353                   ".literal8", 0)               \
354 SECTION_FUNCTION (constructor_section,          \
355                   in_constructor,               \
356                   ".constructor", 0)            \
357 SECTION_FUNCTION (mod_init_section,             \
358                   in_mod_init,                  \
359                   ".mod_init_func", 0)  \
360 SECTION_FUNCTION (mod_term_section, \
361                   in_mod_term,                  \
362                   ".mod_term_func", 0)  \
363 SECTION_FUNCTION (destructor_section,           \
364                   in_destructor,                \
365                   ".destructor", 0)             \
366 SECTION_FUNCTION (objc_class_section,           \
367                   in_objc_class,                \
368                   ".objc_class", 1)             \
369 SECTION_FUNCTION (objc_meta_class_section,      \
370                   in_objc_meta_class,           \
371                   ".objc_meta_class", 1)        \
372 SECTION_FUNCTION (objc_category_section,        \
373                   in_objc_category,             \
374                 ".objc_category", 1)            \
375 SECTION_FUNCTION (objc_class_vars_section,      \
376                   in_objc_class_vars,           \
377                   ".objc_class_vars", 1)        \
378 SECTION_FUNCTION (objc_instance_vars_section,   \
379                   in_objc_instance_vars,        \
380                   ".objc_instance_vars", 1)     \
381 SECTION_FUNCTION (objc_cls_meth_section,        \
382                   in_objc_cls_meth,             \
383                   ".objc_cls_meth", 1)  \
384 SECTION_FUNCTION (objc_inst_meth_section,       \
385                   in_objc_inst_meth,            \
386                   ".objc_inst_meth", 1) \
387 SECTION_FUNCTION (objc_cat_cls_meth_section,    \
388                   in_objc_cat_cls_meth,         \
389                   ".objc_cat_cls_meth", 1)      \
390 SECTION_FUNCTION (objc_cat_inst_meth_section,   \
391                   in_objc_cat_inst_meth,        \
392                   ".objc_cat_inst_meth", 1)     \
393 SECTION_FUNCTION (objc_selector_refs_section,   \
394                   in_objc_selector_refs,        \
395                   ".objc_message_refs", 1)      \
396 SECTION_FUNCTION (objc_selector_fixup_section,  \
397                   in_objc_selector_fixup,       \
398                   ".section __OBJC, __sel_fixup", 1)    \
399 SECTION_FUNCTION (objc_symbols_section,         \
400                   in_objc_symbols,              \
401                   ".objc_symbols", 1)   \
402 SECTION_FUNCTION (objc_module_info_section,     \
403                   in_objc_module_info,          \
404                   ".objc_module_info", 1)       \
405 SECTION_FUNCTION (objc_protocol_section,        \
406                   in_objc_protocol,             \
407                   ".objc_protocol", 1)  \
408 SECTION_FUNCTION (objc_string_object_section,   \
409                   in_objc_string_object,        \
410                   ".objc_string_object", 1)     \
411 SECTION_FUNCTION (objc_constant_string_object_section,  \
412                   in_objc_constant_string_object,       \
413                   ".section __OBJC, __cstring_object", 1)       \
414 SECTION_FUNCTION (objc_class_names_section,     \
415                 in_objc_class_names,            \
416                 ".objc_class_names", 1) \
417 SECTION_FUNCTION (objc_meth_var_names_section,  \
418                 in_objc_meth_var_names,         \
419                 ".objc_meth_var_names", 1)      \
420 SECTION_FUNCTION (objc_meth_var_types_section,  \
421                 in_objc_meth_var_types,         \
422                 ".objc_meth_var_types", 1)      \
423 SECTION_FUNCTION (objc_cls_refs_section,        \
424                 in_objc_cls_refs,               \
425                 ".objc_cls_refs", 1)            \
426                                                 \
427 SECTION_FUNCTION (machopic_lazy_symbol_ptr_section,     \
428                 in_machopic_lazy_symbol_ptr,            \
429                 ".lazy_symbol_pointer", 0)              \
430 SECTION_FUNCTION (machopic_nl_symbol_ptr_section,       \
431                 in_machopic_nl_symbol_ptr,              \
432                 ".non_lazy_symbol_pointer", 0)          \
433 SECTION_FUNCTION (machopic_symbol_stub_section,         \
434                 in_machopic_symbol_stub,                \
435                 ".symbol_stub", 0)                      \
436 SECTION_FUNCTION (machopic_picsymbol_stub_section,      \
437                 in_machopic_picsymbol_stub,             \
438                 ".picsymbol_stub", 0)                   \
439 SECTION_FUNCTION (darwin_exception_section,             \
440                 in_darwin_exception,                    \
441                 ".section __DATA,__gcc_except_tab", 0)  \
442 SECTION_FUNCTION (darwin_eh_frame_section,              \
443                 in_darwin_eh_frame,                     \
444                 ".section __TEXT,__eh_frame", 0)        \
445                                                         \
446 static void                                     \
447 objc_section_init ()                            \
448 {                                               \
449   static int been_here = 0;                     \
450                                                 \
451   if (been_here == 0)                           \
452     {                                           \
453       been_here = 1;                            \
454           /* written, cold -> hot */            \
455       objc_cat_cls_meth_section ();             \
456       objc_cat_inst_meth_section ();            \
457       objc_string_object_section ();            \
458       objc_constant_string_object_section ();   \
459       objc_selector_refs_section ();            \
460       objc_selector_fixup_section ();           \
461       objc_cls_refs_section ();                 \
462       objc_class_section ();                    \
463       objc_meta_class_section ();               \
464           /* shared, hot -> cold */             \
465       objc_cls_meth_section ();                 \
466       objc_inst_meth_section ();                \
467       objc_protocol_section ();                 \
468       objc_class_names_section ();              \
469       objc_meth_var_types_section ();           \
470       objc_meth_var_names_section ();           \
471       objc_category_section ();                 \
472       objc_class_vars_section ();               \
473       objc_instance_vars_section ();            \
474       objc_module_info_section ();              \
475       objc_symbols_section ();                  \
476     }                                           \
477 }
478
479 #define READONLY_DATA_SECTION const_section
480
481 #undef  TARGET_ASM_SELECT_SECTION
482 #define TARGET_ASM_SELECT_SECTION machopic_select_section
483 #undef  TARGET_ASM_SELECT_RTX_SECTION
484 #define TARGET_ASM_SELECT_RTX_SECTION machopic_select_rtx_section
485
486 #define ASM_DECLARE_UNRESOLVED_REFERENCE(FILE,NAME)                     \
487     do {                                                                \
488          if (FILE) {                                                    \
489            if (flag_pic)                                                \
490              fprintf (FILE, "\t.lazy_reference ");                      \
491            else                                                         \
492              fprintf (FILE, "\t.reference ");                           \
493            assemble_name (FILE, NAME);                                  \
494            fprintf (FILE, "\n");                                        \
495          }                                                              \
496        } while (0)
497
498 #define ASM_DECLARE_CLASS_REFERENCE(FILE,NAME)                          \
499     do {                                                                \
500          if (FILE) {                                                    \
501            fprintf (FILE, "\t");                                        \
502            assemble_name (FILE, NAME);                                  \
503            fprintf (FILE, "=0\n");                                      \
504            (*targetm.asm_out.globalize_label) (FILE, NAME);             \
505          }                                                              \
506        } while (0)
507
508 /* Globalizing directive for a label.  */
509 #define GLOBAL_ASM_OP ".globl "
510 #define TARGET_ASM_GLOBALIZE_LABEL darwin_globalize_label
511
512 #undef ASM_GENERATE_INTERNAL_LABEL
513 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)   \
514   sprintf (LABEL, "*%s%ld", PREFIX, (long)(NUM))
515
516 /* This is how to output an internal numbered label where PREFIX is
517    the class of label and NUM is the number within the class.  */
518
519 #undef ASM_OUTPUT_INTERNAL_LABEL
520 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)      \
521   fprintf (FILE, "%s%d:\n", PREFIX, NUM)
522
523 /* Since we have a separate readonly data section, define this so that
524    jump tables end up in text rather than data.  */
525
526 #ifndef JUMP_TABLES_IN_TEXT_SECTION
527 #define JUMP_TABLES_IN_TEXT_SECTION 1
528 #endif
529
530 /* Symbolic names for various things we might know about a symbol.  */
531
532 enum machopic_addr_class {
533   MACHOPIC_UNDEFINED,
534   MACHOPIC_DEFINED_DATA,
535   MACHOPIC_UNDEFINED_DATA,
536   MACHOPIC_DEFINED_FUNCTION,
537   MACHOPIC_UNDEFINED_FUNCTION
538 };
539
540 /* Macros defining the various PIC cases.  */
541
542 #define MACHOPIC_INDIRECT      (flag_pic)
543 #define MACHOPIC_JUST_INDIRECT (flag_pic == 1)
544 #define MACHOPIC_PURE          (flag_pic == 2)
545
546 #undef TARGET_ENCODE_SECTION_INFO
547 #define TARGET_ENCODE_SECTION_INFO  darwin_encode_section_info
548 #undef TARGET_STRIP_NAME_ENCODING
549 #define TARGET_STRIP_NAME_ENCODING  darwin_strip_name_encoding
550
551 #define GEN_BINDER_NAME_FOR_STUB(BUF,STUB,STUB_LENGTH)          \
552   do {                                                          \
553     const char *const stub_ = (STUB);                           \
554     char *buffer_ = (BUF);                                      \
555     strcpy (buffer_, stub_);                                    \
556     if (stub_[0] == '"')                                        \
557       {                                                         \
558         strcpy (buffer_ + (STUB_LENGTH) - 1, "_binder\"");      \
559       }                                                         \
560     else                                                        \
561       {                                                         \
562         strcpy (buffer_ + (STUB_LENGTH), "_binder");            \
563       }                                                         \
564   } while (0)
565
566 #define GEN_SYMBOL_NAME_FOR_SYMBOL(BUF,SYMBOL,SYMBOL_LENGTH)    \
567   do {                                                          \
568     const char *const symbol_ = (SYMBOL);                       \
569     char *buffer_ = (BUF);                                      \
570     if (name_needs_quotes (symbol_) && symbol_[0] != '"')       \
571       {                                                         \
572           sprintf (buffer_, "\"%s\"", symbol_);                 \
573       }                                                         \
574     else                                                        \
575       {                                                         \
576         strcpy (buffer_, symbol_);                              \
577       }                                                         \
578   } while (0)
579
580 /* Given a symbol name string, create the lazy pointer version
581    of the symbol name.  */
582
583 #define GEN_LAZY_PTR_NAME_FOR_SYMBOL(BUF,SYMBOL,SYMBOL_LENGTH)  \
584   do {                                                          \
585     const char *symbol_ = darwin_strip_name_encoding (SYMBOL);  \
586     char *buffer_ = (BUF);                                      \
587     if (symbol_[0] == '"')                                      \
588       {                                                         \
589         strcpy (buffer_, "\"L");                                \
590         strcpy (buffer_ + 2, symbol_ + 1);                      \
591         strcpy (buffer_ + (SYMBOL_LENGTH), "$lazy_ptr\"");      \
592       }                                                         \
593     else if (name_needs_quotes (symbol_))                       \
594       {                                                         \
595         strcpy (buffer_, "\"L");                                \
596         strcpy (buffer_ + 2, symbol_);                          \
597         strcpy (buffer_ + (SYMBOL_LENGTH) + 2, "$lazy_ptr\"");  \
598       }                                                         \
599     else                                                        \
600       {                                                         \
601         strcpy (buffer_, "L");                                  \
602         strcpy (buffer_ + 1, symbol_);                          \
603         strcpy (buffer_ + (SYMBOL_LENGTH) + 1, "$lazy_ptr");    \
604       }                                                         \
605   } while (0)
606
607 #define TARGET_ASM_EXCEPTION_SECTION darwin_exception_section
608
609 #define TARGET_ASM_EH_FRAME_SECTION darwin_eh_frame_section
610   
611 #undef ASM_PREFERRED_EH_DATA_FORMAT
612 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)  \
613   (((CODE) == 2 && (GLOBAL) == 1) \
614    ? (DW_EH_PE_pcrel | DW_EH_PE_indirect) : \
615      ((CODE) == 1 || (GLOBAL) == 0) ? DW_EH_PE_pcrel : DW_EH_PE_absptr)
616
617 #define ASM_OUTPUT_DWARF_DELTA(FILE,SIZE,LABEL1,LABEL2)  \
618   darwin_asm_output_dwarf_delta (FILE, SIZE, LABEL1, LABEL2)
619
620 #define TARGET_TERMINATE_DW2_EH_FRAME_INFO false
621
622 #define DARWIN_REGISTER_TARGET_PRAGMAS(PFILE)                           \
623   do {                                                                  \
624     cpp_register_pragma (PFILE, 0, "mark", darwin_pragma_ignore);       \
625     cpp_register_pragma (PFILE, 0, "options", darwin_pragma_options);   \
626     cpp_register_pragma (PFILE, 0, "segment", darwin_pragma_ignore);    \
627     cpp_register_pragma (PFILE, 0, "unused", darwin_pragma_unused);     \
628   } while (0)
629
630 #undef ASM_APP_ON
631 #define ASM_APP_ON ""
632 #undef ASM_APP_OFF
633 #define ASM_APP_OFF ""