OSDN Git Service

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