1 /* Operating system specific defines to be used when targeting GCC
3 Copyright (C) 1989, 1990, 1991, 1992, 1993, 1996, 1997,
4 1999, 2002 Free Software Foundation, Inc.
6 This file is part of GNU CC.
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)
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.
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. */
23 /* Use new NeXT include file search path.
24 In a cross compiler with NeXT as target, don't expect
25 the host to use Next's directory scheme. */
28 #undef INCLUDE_DEFAULTS
29 #define INCLUDE_DEFAULTS \
31 { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \
32 { LOCAL_INCLUDE_DIR, 0, 0, 1 }, \
33 { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1 }, \
34 { GCC_INCLUDE_DIR, "GCC", 0, 0 }, \
35 /* These are for fixincludes-fixed ansi/bsd headers \
36 which wouldn't be found otherwise. \
37 (The use of string catenation here is OK since \
38 NeXT's native compiler is derived from GCC.) */ \
39 { GCC_INCLUDE_DIR "/ansi", 0, 0, 0 }, \
40 { GCC_INCLUDE_DIR "/bsd", 0, 0, 0 }, \
41 { "/NextDeveloper/Headers", 0, 0, 0 }, \
42 { "/NextDeveloper/Headers/ansi", 0, 0, 0 }, \
43 { "/NextDeveloper/Headers/bsd", 0, 0, 0 }, \
44 { "/LocalDeveloper/Headers", 0, 0, 0 }, \
45 { "/LocalDeveloper/Headers/ansi", 0, 0, 0 }, \
46 { "/LocalDeveloper/Headers/bsd", 0, 0, 0 }, \
47 { "/NextDeveloper/2.0CompatibleHeaders", 0, 0, 0 }, \
48 { STANDARD_INCLUDE_DIR, 0, 0, 0 }, \
49 { "/usr/include/bsd", 0, 0, 0 }, \
52 #else /* CROSS_COMPILE */
53 #undef INCLUDE_DEFAULTS
54 #define INCLUDE_DEFAULTS \
56 { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \
57 { GPLUSPLUS_INCLUDE_DIR, 0, 1, 1 }, \
58 { GCC_INCLUDE_DIR, "GCC", 0, 0 }, \
59 { GCC_INCLUDE_DIR "/ansi", 0, 0, 0 }, \
60 { GCC_INCLUDE_DIR "/bsd", 0, 0, 0 }, \
61 { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1 }, \
62 { TOOL_INCLUDE_DIR "/ansi", 0, 0, 0 }, \
63 { TOOL_INCLUDE_DIR "/bsd", 0, 0, 0 }, \
64 { "/usr/include/bsd", 0, 0, 0 }, \
67 #endif /* CROSS_COMPILE */
69 #undef EXTRA_FORMAT_FUNCTIONS
70 #define EXTRA_FORMAT_FUNCTIONS \
71 "NXPrintf", FALSE, 2, FALSE, \
72 "NXScanf", TRUE, 2, FALSE, \
73 "NXVPrintf", FALSE, 2, TRUE, \
74 "NXVScanf", TRUE, 2, TRUE, \
75 "DPSPrintf", FALSE, 2, FALSE, \
76 "bsd_sprintf", FALSE, 2, FALSE, \
77 "bsd_vsprintf", FALSE, 2, TRUE,
79 /* Make -fnext-runtime the default. */
81 #define NEXT_OBJC_RUNTIME
83 /* Enable recent gcc to compile under the old gcc in Next release 1.0. */
85 #define __inline inline
87 /* wchar_t is unsigned short */
90 #define WCHAR_TYPE "short unsigned int"
91 #undef WCHAR_TYPE_SIZE
92 #define WCHAR_TYPE_SIZE (BITS_PER_WORD / 2)
94 /* Don't default to pcc-struct-return, because gcc is the only compiler, and
95 we want to retain compatibility with older gcc versions. */
97 #undef DEFAULT_PCC_STRUCT_RETURN
98 #define DEFAULT_PCC_STRUCT_RETURN 0
100 /* These compiler options take n arguments. */
102 #undef WORD_SWITCH_TAKES_ARG
103 #define WORD_SWITCH_TAKES_ARG(STR) \
104 (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) ? 1 : \
105 !strcmp (STR, "segalign") ? 1 : \
106 !strcmp (STR, "seg1addr") ? 1 : \
107 !strcmp (STR, "segaddr") ? 2 : \
108 !strcmp (STR, "sectobjectsymbols") ? 2 : \
109 !strcmp (STR, "segprot") ? 3 : \
110 !strcmp (STR, "sectcreate") ? 3 : \
111 !strcmp (STR, "sectalign") ? 3 : \
112 !strcmp (STR, "segcreate") ? 3 : \
113 !strcmp (STR, "sectorder") ? 3 : \
114 !strcmp (STR, "siff-mask") ? 1 : \
115 !strcmp (STR, "siff-filter") ? 1 : \
116 !strcmp (STR, "siff-warning") ? 1 : \
117 !strcmp (STR, "arch") ? 1 : \
118 !strcmp (STR, "pagezero_size") ? 1 : \
122 #define WORD_SWITCH(STR) \
123 (WORD_SWITCH_TAKES_ARG (STR) \
124 || !strcmp (STR, "bsd") \
125 || !strcmp (STR, "object") \
126 || !strcmp (STR, "ObjC") \
127 || !strcmp (STR, "all_load"))
129 /* Machine dependent ccp options. */
132 #define CPP_SPEC "%{posixstrict:-D_POSIX_SOURCE} \
133 %{!posixstrict:%{bsd:-D__STRICT_BSD__} \
134 %{posix:-D_POSIX_SOURCE} \
135 %{!ansi:-D_NEXT_SOURCE}} \
136 %{MD:-MD %M} %{MMD:-MMD %M}"
138 /* Machine dependent ld options. */
141 #define LINK_SPEC "%{Z} %{M} \
142 %{execute*} %{preload*} %{fvmlib*} \
143 %{segalign*} %{seg1addr*} %{segaddr*} %{segprot*} \
145 %{seglinkedit*} %{noseglinkedit*} \
146 %{sectcreate*} %{sectalign*} %{sectobjectsymbols}\
147 %{segcreate*} %{Mach*} %{whyload} %{w} \
148 %{sectorder*} %{whatsloaded} %{ObjC} %{all_load} %{object}"
150 /* Machine dependent libraries. */
153 #define LIB_SPEC "%{!posix*:-lsys_s} %{posix*:-lposix}"
155 /* We specify crt0.o as -lcrt0.o so that ld will search the library path. */
157 #undef STARTFILE_SPEC
158 #define STARTFILE_SPEC \
159 "%{!posix*:%{pg:-lgcrt0.o}%{!pg: \
160 %{p:%e-p profiling is no longer supported. Use -pg instead} \
162 %{posix*:%{pg:-lgposixcrt0.o}%{!pg: \
163 %{p:%e-p profiling is no longer supported. Use -pg instead} \
164 %{!p:-lposixcrt0.o}}} \
168 #define ENDFILE_SPEC \
171 /* Allow #sscs (but don't do anything). */
173 #define SCCS_DIRECTIVE
175 /* We use Dbx symbol format. */
177 #undef SDB_DEBUGGING_INFO
178 #undef XCOFF_DEBUGGING_INFO
179 #define DBX_DEBUGGING_INFO
181 /* This saves a fair amount of space. */
183 #undef DBX_CONTIN_LENGTH
184 #define DBX_CONTIN_LENGTH 0
186 /* These screw up NeXT's gdb at the moment, so don't use them. */
188 #undef DBX_OUTPUT_MAIN_SOURCE_DIRECTORY
189 #define DBX_OUTPUT_MAIN_SOURCE_DIRECTORY(FILE, FILENAME)
191 /* These come from bsd386.h, but are specific to sequent, so make sure
192 they don't bite us. */
195 #undef DBX_CONTIN_LENGTH
197 /* gdb needs a null N_SO at the end of each file for scattered loading. */
199 #undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
200 #define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
202 "\t.text\n\t.stabs \"%s\",%d,0,0,Letext\nLetext:\n", \
205 /* Define our object format type for crtstuff.c */
206 #define OBJECT_FORMAT_MACHO
208 #undef INIT_SECTION_ASM_OP
209 #define INIT_SECTION_ASM_OP
212 #define TARGET_ASM_CONSTRUCTOR nextstep_asm_out_constructor
213 #define TARGET_ASM_DESTRUCTOR nextstep_asm_out_destructor
215 #define TARGET_ASM_EXCEPTION_SECTION nextstep_exception_section
217 #define TARGET_ASM_EH_FRAME_SECTION nextstep_eh_frame_section
219 /* Don't output a .file directive. That is only used by the assembler for
221 #undef ASM_FILE_START
222 #define ASM_FILE_START(FILE)
225 #define ASM_FILE_END(FILE) \
227 if (strcmp (lang_hooks.name, "GNU C++") == 0) \
229 constructor_section (); \
230 destructor_section (); \
231 ASM_OUTPUT_ALIGN (FILE, 1); \
235 /* How to parse #pragma's */
238 #define HANDLE_PRAGMA(GETC, UNGETC, NAME) handle_pragma (GETC, UNGETC, NAME)
240 /* Give methods pretty symbol names on NeXT. */
242 #undef OBJC_GEN_METHOD_LABEL
243 #define OBJC_GEN_METHOD_LABEL(BUF,IS_INST,CLASS_NAME,CAT_NAME,SEL_NAME,NUM) \
245 sprintf (BUF, "%c[%s(%s) %s]", (IS_INST) ? '-' : '+', \
246 (CLASS_NAME), (CAT_NAME), (SEL_NAME)); \
248 sprintf (BUF, "%c[%s %s]", (IS_INST) ? '-' : '+', \
249 (CLASS_NAME), (SEL_NAME)); \
252 /* The prefix to add to user-visible assembler symbols. */
254 #undef USER_LABEL_PREFIX
255 #define USER_LABEL_PREFIX "_"
257 /* Wrap new method names in quotes so the assembler doesn't gag.
258 Make Objective-C internal symbols local. */
260 #undef ASM_OUTPUT_LABELREF
261 #define ASM_OUTPUT_LABELREF(FILE,NAME) \
262 do { if (NAME[0] == '+' || NAME[0] == '-') fprintf (FILE, "\"%s\"", NAME); \
263 else if (!strncmp (NAME, "_OBJC_", 6)) fprintf (FILE, "L%s", NAME); \
264 else if (!strncmp (NAME, ".objc_class_name_", 17)) \
265 fprintf (FILE, "%s", NAME); \
266 else asm_fprintf (FILE, "%U%s", NAME); } while (0)
269 #define ALIGN_ASM_OP "\t.align\t"
271 #undef ASM_OUTPUT_ALIGN
272 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
274 fprintf (FILE, "%s%d\n", ALIGN_ASM_OP, (LOG))
276 /* Ensure correct alignment of bss data. */
278 #undef ASM_OUTPUT_ALIGNED_LOCAL
279 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
280 ( fputs (".lcomm ", (FILE)), \
281 assemble_name ((FILE), (NAME)), \
282 fprintf ((FILE), ",%u,%u\n", (SIZE), floor_log2 ((ALIGN) / BITS_PER_UNIT)))
284 /* Output #ident as a .ident. */
286 #undef ASM_OUTPUT_IDENT
287 #define ASM_OUTPUT_IDENT(FILE, NAME) fprintf (FILE, "\t.ident \"%s\"\n", NAME);
289 /* The maximum alignment which the object file format can support.
290 For NeXT's Mach-O format, this is 2^15. */
292 #undef MAX_OFILE_ALIGNMENT
293 #define MAX_OFILE_ALIGNMENT 0x8000
295 /* Create new Mach-O sections. */
297 #undef SECTION_FUNCTION
298 #define SECTION_FUNCTION(FUNCTION, SECTION, DIRECTIVE, WAS_TEXT, OBJC) \
299 extern void FUNCTION PARAMS ((void)); \
303 extern int flag_no_mach_text_sections; \
305 if (WAS_TEXT && flag_no_mach_text_sections) \
307 else if (in_section != SECTION) \
310 objc_section_init (); \
311 fprintf (asm_out_file, "%s\n", DIRECTIVE); \
312 in_section = SECTION; \
316 #undef EXTRA_SECTIONS
317 #define EXTRA_SECTIONS \
318 in_const, in_cstring, in_literal4, in_literal8, \
319 in_constructor, in_destructor, \
320 in_nextstep_exception, in_nextstep_eh_frame, \
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_symbols, in_objc_module_info, \
327 in_objc_protocol, in_objc_string_object, \
328 in_objc_class_names, in_objc_meth_var_names, \
329 in_objc_meth_var_types, in_objc_cls_refs
331 #undef EXTRA_SECTION_FUNCTIONS
332 #define EXTRA_SECTION_FUNCTIONS \
333 extern void objc_section_init PARAMS ((void)); \
334 SECTION_FUNCTION (const_section, \
337 SECTION_FUNCTION (cstring_section, \
340 SECTION_FUNCTION (literal4_section, \
343 SECTION_FUNCTION (literal8_section, \
346 SECTION_FUNCTION (constructor_section, \
348 ".constructor", 0, 0) \
349 SECTION_FUNCTION (destructor_section, \
351 ".destructor", 0, 0) \
352 SECTION_FUNCTION (nextstep_exception_section, \
353 in_nextstep_exception, \
354 ".section __TEXT,__gcc_except_tab,regular", 0, 0) \
355 SECTION_FUNCTION (nextstep_eh_frame_section, \
356 in_nextstep_eh_frame, \
357 ".section __TEXT,__eh_frame,regular", 0, 0) \
358 SECTION_FUNCTION (objc_class_section, \
360 ".objc_class", 0, 1) \
361 SECTION_FUNCTION (objc_meta_class_section, \
362 in_objc_meta_class, \
363 ".objc_meta_class", 0, 1) \
364 SECTION_FUNCTION (objc_category_section, \
366 ".objc_category", 0, 1) \
367 SECTION_FUNCTION (objc_class_vars_section, \
368 in_objc_class_vars, \
369 ".objc_class_vars", 0, 1) \
370 SECTION_FUNCTION (objc_instance_vars_section, \
371 in_objc_instance_vars, \
372 ".objc_instance_vars", 0, 1) \
373 SECTION_FUNCTION (objc_cls_meth_section, \
375 ".objc_cls_meth", 0, 1) \
376 SECTION_FUNCTION (objc_inst_meth_section, \
378 ".objc_inst_meth", 0, 1) \
379 SECTION_FUNCTION (objc_cat_cls_meth_section, \
380 in_objc_cat_cls_meth, \
381 ".objc_cat_cls_meth", 0, 1) \
382 SECTION_FUNCTION (objc_cat_inst_meth_section, \
383 in_objc_cat_inst_meth, \
384 ".objc_cat_inst_meth", 0, 1) \
385 SECTION_FUNCTION (objc_selector_refs_section, \
386 in_objc_selector_refs, \
387 ".objc_message_refs", 0, 1) \
388 SECTION_FUNCTION (objc_symbols_section, \
390 ".objc_symbols", 0, 1) \
391 SECTION_FUNCTION (objc_module_info_section, \
392 in_objc_module_info, \
393 ".objc_module_info", 0, 1) \
394 SECTION_FUNCTION (objc_protocol_section, \
396 ".objc_protocol", 0, 1) \
397 SECTION_FUNCTION (objc_string_object_section, \
398 in_objc_string_object, \
399 ".objc_string_object", 0, 1) \
400 SECTION_FUNCTION (objc_class_names_section, \
401 in_objc_class_names, \
402 ".objc_class_names", 0, 1) \
403 SECTION_FUNCTION (objc_meth_var_names_section, \
404 in_objc_meth_var_names, \
405 ".objc_meth_var_names", 0, 1) \
406 SECTION_FUNCTION (objc_meth_var_types_section, \
407 in_objc_meth_var_types, \
408 ".objc_meth_var_types", 0, 1) \
409 SECTION_FUNCTION (objc_cls_refs_section, \
411 ".objc_cls_refs", 0, 1) \
414 objc_section_init () \
416 static int been_here = 0; \
418 if (been_here == 0) \
421 objc_class_section (); \
422 objc_meta_class_section (); \
423 objc_cat_cls_meth_section (); \
424 objc_cat_inst_meth_section (); \
425 objc_cls_meth_section (); \
426 objc_inst_meth_section (); \
427 objc_selector_refs_section (); \
428 objc_symbols_section (); \
429 objc_category_section (); \
430 objc_protocol_section (); \
431 objc_class_vars_section (); \
432 objc_instance_vars_section (); \
433 objc_module_info_section (); \
434 objc_string_object_section (); \
435 objc_class_names_section (); \
436 objc_meth_var_names_section (); \
437 objc_meth_var_types_section (); \
438 objc_cls_refs_section (); \
442 #define READONLY_DATA_SECTION const_section
444 #undef TARGET_ASM_SELECT_SECTION
445 #define TARGET_ASM_SELECT_SECTION nextstep_select_section
446 #undef TARGET_ASM_SELECT_RTX_SECTION
447 #define TARGET_ASM_SELECT_RTX_SECTION nextstep_select_rtx_section
449 #ifdef ASM_COMMENT_START
450 # undef ASM_COMMENT_START
453 #define ASM_COMMENT_START ";#"