1 /* Target definitions for x86 running Darwin.
2 Copyright (C) 2001, 2002 Free Software Foundation, Inc.
3 Contributed by Apple Computer Inc.
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 /* Enable Mach-O bits in generic x86 code. */
24 #define TARGET_MACHO 1
26 #define TARGET_VERSION fprintf (stderr, " (i386 Darwin)");
28 #define TARGET_OS_CPP_BUILTINS() \
31 builtin_define ("__i386__"); \
32 builtin_define ("__LITTLE_ENDIAN__"); \
33 builtin_define ("__MACH__"); \
34 builtin_define ("__APPLE__"); \
38 /* We want -fPIC by default, unless we're using -static to compile for
39 the kernel or some such. */
42 #define CC1_SPEC "%{!static:-fPIC}"
44 /* The Darwin assembler mostly follows AT&T syntax. */
45 #undef ASSEMBLER_DIALECT
46 #define ASSEMBLER_DIALECT ASM_ATT
48 /* Define macro used to output shift-double opcodes when the shift
49 count is in %cl. Some assemblers require %cl as an argument;
50 some don't. This macro controls what to do: by default, don't
53 #define SHIFT_DOUBLE_OMITS_COUNT 0
55 /* Define the syntax of pseudo-ops, labels and comments. */
57 /* String containing the assembler's comment-starter. */
59 #define ASM_COMMENT_START "#"
61 /* By default, target has a 80387, uses IEEE compatible arithmetic,
62 and returns float values in the 387. */
64 #define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
66 /* TARGET_DEEP_BRANCH_PREDICTION is incompatible with Mach-O PIC. */
68 #undef TARGET_DEEP_BRANCH_PREDICTION
69 #define TARGET_DEEP_BRANCH_PREDICTION 0
71 /* For now, disable dynamic-no-pic. We'll need to go through i386.c
72 with a fine-tooth comb looking for refs to flag_pic! */
73 #define MASK_MACHO_DYNAMIC_NO_PIC 0
74 #define TARGET_DYNAMIC_NO_PIC (target_flags & MASK_MACHO_DYNAMIC_NO_PIC)
76 /* Define the syntax of pseudo-ops, labels and comments. */
80 /* Assembler pseudos to introduce constants of various size. */
82 #define ASM_BYTE_OP "\t.byte\t"
83 #define ASM_SHORT "\t.word\t"
84 #define ASM_LONG "\t.long\t"
85 /* Darwin as doesn't do ".quad". */
87 #undef ASM_OUTPUT_ALIGN
88 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
89 do { if ((LOG) != 0) \
91 if (in_text_section ()) \
92 fprintf (FILE, "\t%s %d,0x90\n", ALIGN_ASM_OP, (LOG)); \
94 fprintf (FILE, "\t%s %d\n", ALIGN_ASM_OP, (LOG)); \
98 /* This says how to output an assembler line
99 to define a global common symbol. */
101 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
102 ( fputs (".comm ", (FILE)), \
103 assemble_name ((FILE), (NAME)), \
104 fprintf ((FILE), ",%lu\n", (unsigned long)(ROUNDED)))
106 /* This says how to output an assembler line
107 to define a local common symbol. */
109 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
110 ( fputs (".lcomm ", (FILE)), \
111 assemble_name ((FILE), (NAME)), \
112 fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED"\n", (ROUNDED)))
114 /* Darwin profiling -- call mcount. */
115 #undef FUNCTION_PROFILER
116 #define FUNCTION_PROFILER(FILE, LABELNO) \
118 if (MACHOPIC_INDIRECT) \
120 const char *name = machopic_stub_name ("*mcount"); \
121 fprintf (FILE, "\tcall %s\n", name+1); /* skip '&' */ \
122 machopic_validate_stub_or_non_lazy_ptr (name, /*stub:*/1); \
124 else fprintf (FILE, "\tcall mcount\n"); \