darwin.h revision 117395
1/* Target definitions for x86 running Darwin. 2 Copyright (C) 2001, 2002 Free Software Foundation, Inc. 3 Contributed by Apple Computer Inc. 4 5This file is part of GNU CC. 6 7GNU CC is free software; you can redistribute it and/or modify 8it under the terms of the GNU General Public License as published by 9the Free Software Foundation; either version 2, or (at your option) 10any later version. 11 12GNU CC is distributed in the hope that it will be useful, 13but WITHOUT ANY WARRANTY; without even the implied warranty of 14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15GNU General Public License for more details. 16 17You should have received a copy of the GNU General Public License 18along with GNU CC; see the file COPYING. If not, write to 19the Free Software Foundation, 59 Temple Place - Suite 330, 20Boston, MA 02111-1307, USA. */ 21 22/* Enable Mach-O bits in generic x86 code. */ 23#undef TARGET_MACHO 24#define TARGET_MACHO 1 25 26#define TARGET_VERSION fprintf (stderr, " (i386 Darwin)"); 27 28#define TARGET_OS_CPP_BUILTINS() \ 29 do \ 30 { \ 31 builtin_define ("__i386__"); \ 32 builtin_define ("__LITTLE_ENDIAN__"); \ 33 builtin_define ("__MACH__"); \ 34 builtin_define ("__APPLE__"); \ 35 } \ 36 while (0) 37 38/* We want -fPIC by default, unless we're using -static to compile for 39 the kernel or some such. */ 40 41#undef CC1_SPEC 42#define CC1_SPEC "%{!static:-fPIC}" 43 44/* The Darwin assembler mostly follows AT&T syntax. */ 45#undef ASSEMBLER_DIALECT 46#define ASSEMBLER_DIALECT ASM_ATT 47 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 51 print %cl. */ 52 53#define SHIFT_DOUBLE_OMITS_COUNT 0 54 55/* Define the syntax of pseudo-ops, labels and comments. */ 56 57/* String containing the assembler's comment-starter. */ 58 59#define ASM_COMMENT_START "#" 60 61/* By default, target has a 80387, uses IEEE compatible arithmetic, 62 and returns float values in the 387. */ 63 64#define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS) 65 66/* TARGET_DEEP_BRANCH_PREDICTION is incompatible with Mach-O PIC. */ 67 68#undef TARGET_DEEP_BRANCH_PREDICTION 69#define TARGET_DEEP_BRANCH_PREDICTION 0 70 71/* Define the syntax of pseudo-ops, labels and comments. */ 72 73#define LPREFIX "L" 74 75/* Assembler pseudos to introduce constants of various size. */ 76 77#define ASM_BYTE_OP "\t.byte\t" 78#define ASM_SHORT "\t.word\t" 79#define ASM_LONG "\t.long\t" 80/* Darwin as doesn't do ".quad". */ 81 82#undef ASM_OUTPUT_ALIGN 83#define ASM_OUTPUT_ALIGN(FILE,LOG) \ 84 do { if ((LOG) != 0) \ 85 { \ 86 if (in_text_section ()) \ 87 fprintf (FILE, "\t%s %d,0x90\n", ALIGN_ASM_OP, (LOG)); \ 88 else \ 89 fprintf (FILE, "\t%s %d\n", ALIGN_ASM_OP, (LOG)); \ 90 } \ 91 } while (0) 92 93/* This says how to output an assembler line 94 to define a global common symbol. */ 95 96#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ 97( fputs (".comm ", (FILE)), \ 98 assemble_name ((FILE), (NAME)), \ 99 fprintf ((FILE), ",%u\n", (ROUNDED))) 100 101/* This says how to output an assembler line 102 to define a local common symbol. */ 103 104#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ 105( fputs (".lcomm ", (FILE)), \ 106 assemble_name ((FILE), (NAME)), \ 107 fprintf ((FILE), ",%u\n", (ROUNDED))) 108 109/* Darwin profiling -- call mcount. */ 110#undef FUNCTION_PROFILER 111#define FUNCTION_PROFILER(FILE, LABELNO) \ 112 do { \ 113 if (MACHOPIC_INDIRECT) \ 114 { \ 115 const char *name = machopic_stub_name ("*mcount"); \ 116 fprintf (FILE, "\tcall %s\n", name+1); /* skip '&' */ \ 117 machopic_validate_stub_or_non_lazy_ptr (name, /*stub:*/1); \ 118 } \ 119 else fprintf (FILE, "\tcall mcount\n"); \ 120 } while (0) 121