1/* Target definitions for x86 running Darwin. 2 Copyright (C) 2001, 2002, 2004, 2005 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, 51 Franklin Street, Fifth Floor, 20Boston, MA 02110-1301, 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, " (i686 Darwin)"); 27 28#undef TARGET_FPMATH_DEFAULT 29#define TARGET_FPMATH_DEFAULT (TARGET_SSE ? FPMATH_SSE : FPMATH_387) 30 31#define TARGET_OS_CPP_BUILTINS() \ 32 do \ 33 { \ 34 builtin_define ("__i386__"); \ 35 builtin_define ("__LITTLE_ENDIAN__"); \ 36 darwin_cpp_builtins (pfile); \ 37 } \ 38 while (0) 39 40/* We want -fPIC by default, unless we're using -static to compile for 41 the kernel or some such. */ 42 43#undef CC1_SPEC 44#define CC1_SPEC "%{!static:-fPIC}\ 45 %{g: %{!fno-eliminate-unused-debug-symbols: -feliminate-unused-debug-symbols }}" 46 47#undef ASM_SPEC 48#define ASM_SPEC "-arch i386 -force_cpusubtype_ALL" 49 50#undef SUBTARGET_EXTRA_SPECS 51#define SUBTARGET_EXTRA_SPECS \ 52 { "darwin_arch", "i386" }, \ 53 { "darwin_crt2", "" }, \ 54 { "darwin_subarch", "i386" }, 55 56/* Use the following macro for any Darwin/x86-specific command-line option 57 translation. */ 58#define SUBTARGET_OPTION_TRANSLATE_TABLE \ 59 { "", "" } 60 61/* The Darwin assembler mostly follows AT&T syntax. */ 62#undef ASSEMBLER_DIALECT 63#define ASSEMBLER_DIALECT ASM_ATT 64 65/* Define macro used to output shift-double opcodes when the shift 66 count is in %cl. Some assemblers require %cl as an argument; 67 some don't. This macro controls what to do: by default, don't 68 print %cl. */ 69 70#define SHIFT_DOUBLE_OMITS_COUNT 0 71 72/* Define the syntax of pseudo-ops, labels and comments. */ 73 74/* String containing the assembler's comment-starter. */ 75 76#define ASM_COMMENT_START "#" 77 78/* By default, target has a 80387, uses IEEE compatible arithmetic, 79 and returns float values in the 387. */ 80 81#define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_128BIT_LONG_DOUBLE | MASK_ALIGN_DOUBLE) 82 83/* TARGET_DEEP_BRANCH_PREDICTION is incompatible with Mach-O PIC. */ 84 85#undef TARGET_DEEP_BRANCH_PREDICTION 86#define TARGET_DEEP_BRANCH_PREDICTION 0 87 88/* For now, disable dynamic-no-pic. We'll need to go through i386.c 89 with a fine-tooth comb looking for refs to flag_pic! */ 90#define MASK_MACHO_DYNAMIC_NO_PIC 0 91#define TARGET_DYNAMIC_NO_PIC (target_flags & MASK_MACHO_DYNAMIC_NO_PIC) 92 93/* Define the syntax of pseudo-ops, labels and comments. */ 94 95#define LPREFIX "L" 96 97/* These are used by -fbranch-probabilities */ 98#define HOT_TEXT_SECTION_NAME "__TEXT,__text,regular,pure_instructions" 99#define UNLIKELY_EXECUTED_TEXT_SECTION_NAME \ 100 "__TEXT,__unlikely,regular,pure_instructions" 101 102/* Assembler pseudos to introduce constants of various size. */ 103 104#define ASM_BYTE_OP "\t.byte\t" 105#define ASM_SHORT "\t.word\t" 106#define ASM_LONG "\t.long\t" 107/* Darwin as doesn't do ".quad". */ 108 109#undef ASM_OUTPUT_ALIGN 110#define ASM_OUTPUT_ALIGN(FILE,LOG) \ 111 do { if ((LOG) != 0) \ 112 { \ 113 if (in_text_section ()) \ 114 fprintf (FILE, "\t%s %d,0x90\n", ALIGN_ASM_OP, (LOG)); \ 115 else \ 116 fprintf (FILE, "\t%s %d\n", ALIGN_ASM_OP, (LOG)); \ 117 } \ 118 } while (0) 119 120/* This says how to output an assembler line 121 to define a global common symbol. */ 122 123#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ 124( fputs (".comm ", (FILE)), \ 125 assemble_name ((FILE), (NAME)), \ 126 fprintf ((FILE), ",%lu\n", (unsigned long)(ROUNDED))) 127 128/* This says how to output an assembler line 129 to define a local common symbol. */ 130 131#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ 132( fputs (".lcomm ", (FILE)), \ 133 assemble_name ((FILE), (NAME)), \ 134 fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED"\n", (ROUNDED))) 135 136/* Darwin profiling -- call mcount. */ 137#undef FUNCTION_PROFILER 138#define FUNCTION_PROFILER(FILE, LABELNO) \ 139 do { \ 140 if (MACHOPIC_INDIRECT) \ 141 { \ 142 const char *name = machopic_mcount_stub_name (); \ 143 fprintf (FILE, "\tcall %s\n", name+1); /* skip '&' */ \ 144 machopic_validate_stub_or_non_lazy_ptr (name); \ 145 } \ 146 else fprintf (FILE, "\tcall mcount\n"); \ 147 } while (0) 148