OSDN Git Service

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