darwin.h revision 146895
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 GCC. 6 7GCC 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 12GCC 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 GCC; 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/* Use the following macro for any Darwin/x86-specific command-line option 45 translation. */ 46#define SUBTARGET_OPTION_TRANSLATE_TABLE 47 48#define ASM_SPEC "-arch i386 \ 49 %{Zforce_cpusubtype_ALL:-force_cpusubtype_ALL} \ 50 %{!Zforce_cpusubtype_ALL:%{mmmx:-force_cpusubtype_ALL}\ 51 %{msse:-force_cpusubtype_ALL}\ 52 %{msse2:-force_cpusubtype_ALL}}" 53 54#undef SUBTARGET_EXTRA_SPECS 55#define SUBTARGET_EXTRA_SPECS \ 56 { "darwin_arch", "i386" }, 57 58/* The Darwin assembler mostly follows AT&T syntax. */ 59#undef ASSEMBLER_DIALECT 60#define ASSEMBLER_DIALECT ASM_ATT 61 62/* Define macro used to output shift-double opcodes when the shift 63 count is in %cl. Some assemblers require %cl as an argument; 64 some don't. This macro controls what to do: by default, don't 65 print %cl. */ 66 67#define SHIFT_DOUBLE_OMITS_COUNT 0 68 69/* Define the syntax of pseudo-ops, labels and comments. */ 70 71/* String containing the assembler's comment-starter. */ 72 73#define ASM_COMMENT_START "#" 74 75/* By default, target has a 80387, uses IEEE compatible arithmetic, 76 and returns float values in the 387. */ 77 78#define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS) 79 80/* TARGET_DEEP_BRANCH_PREDICTION is incompatible with Mach-O PIC. */ 81 82#undef TARGET_DEEP_BRANCH_PREDICTION 83#define TARGET_DEEP_BRANCH_PREDICTION 0 84 85/* For now, disable dynamic-no-pic. We'll need to go through i386.c 86 with a fine-tooth comb looking for refs to flag_pic! */ 87#define MASK_MACHO_DYNAMIC_NO_PIC 0 88#define TARGET_DYNAMIC_NO_PIC (target_flags & MASK_MACHO_DYNAMIC_NO_PIC) 89 90/* Define the syntax of pseudo-ops, labels and comments. */ 91 92#define LPREFIX "L" 93 94/* Assembler pseudos to introduce constants of various size. */ 95 96#define ASM_BYTE_OP "\t.byte\t" 97#define ASM_SHORT "\t.word\t" 98#define ASM_LONG "\t.long\t" 99/* Darwin as doesn't do ".quad". */ 100 101#undef ASM_OUTPUT_ALIGN 102#define ASM_OUTPUT_ALIGN(FILE,LOG) \ 103 do { if ((LOG) != 0) \ 104 { \ 105 if (in_text_section ()) \ 106 fprintf (FILE, "\t%s %d,0x90\n", ALIGN_ASM_OP, (LOG)); \ 107 else \ 108 fprintf (FILE, "\t%s %d\n", ALIGN_ASM_OP, (LOG)); \ 109 } \ 110 } while (0) 111 112/* This says how to output an assembler line 113 to define a global common symbol. */ 114 115#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ 116( fputs (".comm ", (FILE)), \ 117 assemble_name ((FILE), (NAME)), \ 118 fprintf ((FILE), ",%lu\n", (unsigned long)(ROUNDED))) 119 120/* This says how to output an assembler line 121 to define a local common symbol. */ 122 123#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ 124( fputs (".lcomm ", (FILE)), \ 125 assemble_name ((FILE), (NAME)), \ 126 fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED"\n", (ROUNDED))) 127 128/* Darwin profiling -- call mcount. */ 129#undef FUNCTION_PROFILER 130#define FUNCTION_PROFILER(FILE, LABELNO) \ 131 do { \ 132 if (MACHOPIC_INDIRECT) \ 133 { \ 134 const char *name = machopic_stub_name ("*mcount"); \ 135 fprintf (FILE, "\tcall %s\n", name+1); /* skip '&' */ \ 136 machopic_validate_stub_or_non_lazy_ptr (name, /*stub:*/1); \ 137 } \ 138 else fprintf (FILE, "\tcall mcount\n"); \ 139 } while (0) 140