]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/darwin.h
builtins.def: Fix comment formatting.
[thirdparty/gcc.git] / gcc / config / darwin.h
CommitLineData
ee890fe2 1/* Target definitions for Darwin (Mac OS X) systems.
006946e4 2 Copyright (C) 1989, 1990, 1991, 1992, 1993, 2000, 2001, 2002
ee890fe2
SS
3 Free Software Foundation, Inc.
4 Contributed by Apple Computer Inc.
5
6This file is part of GNU CC.
7
8GNU CC is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 2, or (at your option)
11any later version.
12
13GNU CC is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with GNU CC; see the file COPYING. If not, write to
20the Free Software Foundation, 59 Temple Place - Suite 330,
21Boston, 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
f37f462a
SS
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. */
ee890fe2 37
7606e68f
SS
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
abe72dd8
SS
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.) */
ee890fe2 47
abe72dd8 48#define MATH_LIBRARY ""
ee890fe2
SS
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
f37f462a
SS
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
ee890fe2
SS
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
ee890fe2
SS
87/* Machine dependent cpp options. */
88
ee890fe2 89#undef CPP_SPEC
6f0361e3 90#define CPP_SPEC "%{static:-D__STATIC__}%{!static:-D__DYNAMIC__}"
ee890fe2
SS
91
92/* Machine dependent libraries. */
93
94#undef LIB_SPEC
5fa5a27c 95#define LIB_SPEC "%{!static:-lSystem}"
ee890fe2 96
991b6592 97/* We specify crt0.o as -lcrt0.o so that ld will search the library path. */
ee890fe2
SS
98
99#undef STARTFILE_SPEC
100#define STARTFILE_SPEC \
7606e68f
SS
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"
ee890fe2
SS
107
108#undef DOLLARS_IN_IDENTIFIERS
109#define DOLLARS_IN_IDENTIFIERS 2
110
ee890fe2
SS
111/* We use Dbx symbol format. */
112
23532de9 113#define DBX_DEBUGGING_INFO 1
ee890fe2
SS
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
991b6592 123/* gdb needs a null N_SO at the end of each file for scattered loading. */
ee890fe2
SS
124
125#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
126#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
127do { 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
ee890fe2
SS
136#undef INIT_SECTION_ASM_OP
137#define INIT_SECTION_ASM_OP
138
139#undef INVOKE__main
140
2cc07db4
RH
141#define TARGET_ASM_CONSTRUCTOR machopic_asm_out_constructor
142#define TARGET_ASM_DESTRUCTOR machopic_asm_out_destructor
ee890fe2 143
6ab9a3f4
SS
144/* Always prefix with an underscore. */
145
146#define USER_LABEL_PREFIX "_"
147
ee890fe2
SS
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 { \
ee890fe2 157 machopic_finish (asm_out_file); \
3ac88239 158 if (strcmp (lang_hooks.name, "GNU C++") == 0) \
ee890fe2
SS
159 { \
160 constructor_section (); \
161 destructor_section (); \
162 ASM_OUTPUT_ALIGN (FILE, 1); \
163 } \
164 } while (0)
165
2aa9948d
SS
166#define ASM_OUTPUT_SKIP(FILE,SIZE) \
167 fprintf (FILE, "\t.space %d\n", SIZE)
168
991b6592 169/* Give ObjC methods pretty symbol names. */
ee890fe2
SS
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 { \
91dc3130 190 const char *xname = NAME; \
ee890fe2
SS
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); \
df56a27f
SS
197 if ((TREE_STATIC (DECL) \
198 && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \
199 || DECL_INITIAL (DECL)) \
fb49053f 200 (* targetm.encode_section_info) (DECL, false); \
ee890fe2 201 ASM_OUTPUT_LABEL (FILE, xname); \
93913281
SS
202 } while (0)
203
204#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
205 do { \
91dc3130 206 const char *xname = NAME; \
93913281
SS
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)) \
fb49053f 216 (* targetm.encode_section_info) (DECL, false); \
93913281 217 ASM_OUTPUT_LABEL (FILE, xname); \
b7fb9feb
TC
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); \
ee890fe2
SS
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
772c5265
RH
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); \
ee890fe2
SS
249 } while (0)
250
2aa9948d
SS
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
ee890fe2
SS
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
b2003250
RH
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))) \
fb49053f 280 (* targetm.encode_section_info) (DECL, false); \
b2003250
RH
281 if ((DECL) && ((TREE_STATIC (DECL) \
282 && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \
283 || DECL_INITIAL (DECL))) \
284 machopic_define_name (NAME); \
ee890fe2
SS
285 } while (0)
286
ee890fe2
SS
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
991b6592 293/* Create new Mach-O sections. */
ee890fe2
SS
294
295#undef SECTION_FUNCTION
70fb5453 296#define SECTION_FUNCTION(FUNCTION, SECTION, DIRECTIVE, OBJC) \
91dc3130 297extern void FUNCTION PARAMS ((void)); \
ee890fe2
SS
298void \
299FUNCTION () \
300{ \
70fb5453 301 if (in_section != SECTION) \
ee890fe2
SS
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
ee890fe2
SS
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, \
07c9d2eb 333 in_darwin_exception, in_darwin_eh_frame, \
ee890fe2
SS
334 num_sections
335
336#undef EXTRA_SECTION_FUNCTIONS
337#define EXTRA_SECTION_FUNCTIONS \
91dc3130 338static void objc_section_init PARAMS ((void)); \
ee890fe2
SS
339SECTION_FUNCTION (const_section, \
340 in_const, \
70fb5453 341 ".const", 0) \
ee890fe2
SS
342SECTION_FUNCTION (const_data_section, \
343 in_const_data, \
70fb5453 344 ".const_data", 0) \
ee890fe2
SS
345SECTION_FUNCTION (cstring_section, \
346 in_cstring, \
70fb5453 347 ".cstring", 0) \
ee890fe2
SS
348SECTION_FUNCTION (literal4_section, \
349 in_literal4, \
70fb5453 350 ".literal4", 0) \
ee890fe2
SS
351SECTION_FUNCTION (literal8_section, \
352 in_literal8, \
70fb5453 353 ".literal8", 0) \
ee890fe2
SS
354SECTION_FUNCTION (constructor_section, \
355 in_constructor, \
70fb5453 356 ".constructor", 0) \
ee890fe2
SS
357SECTION_FUNCTION (mod_init_section, \
358 in_mod_init, \
70fb5453 359 ".mod_init_func", 0) \
ee890fe2
SS
360SECTION_FUNCTION (mod_term_section, \
361 in_mod_term, \
70fb5453 362 ".mod_term_func", 0) \
ee890fe2
SS
363SECTION_FUNCTION (destructor_section, \
364 in_destructor, \
70fb5453 365 ".destructor", 0) \
ee890fe2
SS
366SECTION_FUNCTION (objc_class_section, \
367 in_objc_class, \
70fb5453 368 ".objc_class", 1) \
ee890fe2
SS
369SECTION_FUNCTION (objc_meta_class_section, \
370 in_objc_meta_class, \
70fb5453 371 ".objc_meta_class", 1) \
ee890fe2
SS
372SECTION_FUNCTION (objc_category_section, \
373 in_objc_category, \
70fb5453 374 ".objc_category", 1) \
ee890fe2
SS
375SECTION_FUNCTION (objc_class_vars_section, \
376 in_objc_class_vars, \
70fb5453 377 ".objc_class_vars", 1) \
ee890fe2
SS
378SECTION_FUNCTION (objc_instance_vars_section, \
379 in_objc_instance_vars, \
70fb5453 380 ".objc_instance_vars", 1) \
ee890fe2
SS
381SECTION_FUNCTION (objc_cls_meth_section, \
382 in_objc_cls_meth, \
70fb5453 383 ".objc_cls_meth", 1) \
ee890fe2
SS
384SECTION_FUNCTION (objc_inst_meth_section, \
385 in_objc_inst_meth, \
70fb5453 386 ".objc_inst_meth", 1) \
ee890fe2
SS
387SECTION_FUNCTION (objc_cat_cls_meth_section, \
388 in_objc_cat_cls_meth, \
70fb5453 389 ".objc_cat_cls_meth", 1) \
ee890fe2
SS
390SECTION_FUNCTION (objc_cat_inst_meth_section, \
391 in_objc_cat_inst_meth, \
70fb5453 392 ".objc_cat_inst_meth", 1) \
ee890fe2
SS
393SECTION_FUNCTION (objc_selector_refs_section, \
394 in_objc_selector_refs, \
70fb5453 395 ".objc_message_refs", 1) \
ee890fe2
SS
396SECTION_FUNCTION (objc_selector_fixup_section, \
397 in_objc_selector_fixup, \
70fb5453 398 ".section __OBJC, __sel_fixup", 1) \
ee890fe2
SS
399SECTION_FUNCTION (objc_symbols_section, \
400 in_objc_symbols, \
70fb5453 401 ".objc_symbols", 1) \
ee890fe2
SS
402SECTION_FUNCTION (objc_module_info_section, \
403 in_objc_module_info, \
70fb5453 404 ".objc_module_info", 1) \
ee890fe2
SS
405SECTION_FUNCTION (objc_protocol_section, \
406 in_objc_protocol, \
70fb5453 407 ".objc_protocol", 1) \
ee890fe2
SS
408SECTION_FUNCTION (objc_string_object_section, \
409 in_objc_string_object, \
70fb5453 410 ".objc_string_object", 1) \
ee890fe2
SS
411SECTION_FUNCTION (objc_constant_string_object_section, \
412 in_objc_constant_string_object, \
70fb5453 413 ".section __OBJC, __cstring_object", 1) \
ee890fe2
SS
414SECTION_FUNCTION (objc_class_names_section, \
415 in_objc_class_names, \
70fb5453 416 ".objc_class_names", 1) \
ee890fe2
SS
417SECTION_FUNCTION (objc_meth_var_names_section, \
418 in_objc_meth_var_names, \
70fb5453 419 ".objc_meth_var_names", 1) \
ee890fe2
SS
420SECTION_FUNCTION (objc_meth_var_types_section, \
421 in_objc_meth_var_types, \
70fb5453 422 ".objc_meth_var_types", 1) \
ee890fe2
SS
423SECTION_FUNCTION (objc_cls_refs_section, \
424 in_objc_cls_refs, \
70fb5453 425 ".objc_cls_refs", 1) \
ee890fe2
SS
426 \
427SECTION_FUNCTION (machopic_lazy_symbol_ptr_section, \
428 in_machopic_lazy_symbol_ptr, \
70fb5453 429 ".lazy_symbol_pointer", 0) \
ee890fe2
SS
430SECTION_FUNCTION (machopic_nl_symbol_ptr_section, \
431 in_machopic_nl_symbol_ptr, \
70fb5453 432 ".non_lazy_symbol_pointer", 0) \
ee890fe2
SS
433SECTION_FUNCTION (machopic_symbol_stub_section, \
434 in_machopic_symbol_stub, \
70fb5453 435 ".symbol_stub", 0) \
ee890fe2
SS
436SECTION_FUNCTION (machopic_picsymbol_stub_section, \
437 in_machopic_picsymbol_stub, \
70fb5453 438 ".picsymbol_stub", 0) \
abe72dd8
SS
439SECTION_FUNCTION (darwin_exception_section, \
440 in_darwin_exception, \
7606e68f 441 ".section __DATA,__gcc_except_tab", 0) \
07c9d2eb
SS
442SECTION_FUNCTION (darwin_eh_frame_section, \
443 in_darwin_eh_frame, \
444 ".section __TEXT,__eh_frame", 0) \
ee890fe2 445 \
91dc3130 446static void \
ee890fe2
SS
447objc_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 } \
ee890fe2
SS
477}
478
ee890fe2
SS
479#define READONLY_DATA_SECTION const_section
480
ae46c4e0
RH
481#undef TARGET_ASM_SELECT_SECTION
482#define TARGET_ASM_SELECT_SECTION machopic_select_section
b64a1b53
RH
483#undef TARGET_ASM_SELECT_RTX_SECTION
484#define TARGET_ASM_SELECT_RTX_SECTION machopic_select_rtx_section
ee890fe2 485
28df0b5a
SS
486#define ASM_DECLARE_UNRESOLVED_REFERENCE(FILE,NAME) \
487 do { \
488 if (FILE) { \
ee890fe2 489 if (flag_pic) \
28df0b5a 490 fprintf (FILE, "\t.lazy_reference "); \
ee890fe2 491 else \
28df0b5a
SS
492 fprintf (FILE, "\t.reference "); \
493 assemble_name (FILE, NAME); \
494 fprintf (FILE, "\n"); \
ee890fe2
SS
495 } \
496 } while (0)
497
f60b945b
SS
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"); \
5eb99654 504 (*targetm.asm_out.globalize_label) (FILE, NAME); \
ee890fe2
SS
505 } \
506 } while (0)
507
5eb99654
KG
508/* Globalizing directive for a label. */
509#define GLOBAL_ASM_OP ".globl "
510#define TARGET_ASM_GLOBALIZE_LABEL darwin_globalize_label
ee890fe2
SS
511
512#undef ASM_GENERATE_INTERNAL_LABEL
513#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
91dc3130 514 sprintf (LABEL, "*%s%ld", PREFIX, (long)(NUM))
ee890fe2
SS
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
532enum 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
b069de3b 546#undef TARGET_ENCODE_SECTION_INFO
fb49053f 547#define TARGET_ENCODE_SECTION_INFO darwin_encode_section_info
b069de3b 548#undef TARGET_STRIP_NAME_ENCODING
772c5265 549#define TARGET_STRIP_NAME_ENCODING darwin_strip_name_encoding
df56a27f 550
ee890fe2
SS
551#define GEN_BINDER_NAME_FOR_STUB(BUF,STUB,STUB_LENGTH) \
552 do { \
83182544 553 const char *const stub_ = (STUB); \
ee890fe2
SS
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 { \
83182544 568 const char *const symbol_ = (SYMBOL); \
ee890fe2
SS
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 { \
772c5265 585 const char *symbol_ = darwin_strip_name_encoding (SYMBOL); \
ee890fe2
SS
586 char *buffer_ = (BUF); \
587 if (symbol_[0] == '"') \
588 { \
772c5265 589 strcpy (buffer_, "\"L"); \
ee890fe2
SS
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
07c9d2eb 607#define TARGET_ASM_EXCEPTION_SECTION darwin_exception_section
abe72dd8 608
07c9d2eb
SS
609#define TARGET_ASM_EH_FRAME_SECTION darwin_eh_frame_section
610
b069de3b 611#undef ASM_PREFERRED_EH_DATA_FORMAT
abe72dd8 612#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
7606e68f
SS
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
abe72dd8 621
9fe08fd0
RH
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); \
0168a849 628 } while (0)
2aa9948d
SS
629
630#undef ASM_APP_ON
631#define ASM_APP_ON ""
632#undef ASM_APP_OFF
633#define ASM_APP_OFF ""