/* Target definitions for x86 running Darwin. Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2010 Free Software Foundation, Inc. Contributed by Apple Computer Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see . */ /* Enable Mach-O bits in generic x86 code. */ #undef TARGET_MACHO #define TARGET_MACHO 1 #define TARGET_VERSION fprintf (stderr, " (i686 Darwin)"); #undef TARGET_64BIT #define TARGET_64BIT OPTION_ISA_64BIT #ifdef IN_LIBGCC2 #undef TARGET_64BIT #ifdef __x86_64__ #define TARGET_64BIT 1 #else #define TARGET_64BIT 0 #endif #endif /* Size of the Obj-C jump buffer. */ #define OBJC_JBLEN ((TARGET_64BIT) ? ((9 * 2) + 3 + 16) : (18)) #undef TARGET_FPMATH_DEFAULT #define TARGET_FPMATH_DEFAULT (TARGET_SSE ? FPMATH_SSE : FPMATH_387) #define TARGET_OS_CPP_BUILTINS() \ do \ { \ builtin_define ("__LITTLE_ENDIAN__"); \ darwin_cpp_builtins (pfile); \ } \ while (0) #undef PTRDIFF_TYPE #define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int") #undef WCHAR_TYPE #define WCHAR_TYPE "int" #undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE 32 #undef MAX_BITS_PER_WORD #define MAX_BITS_PER_WORD 64 #undef FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN #define FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN (0) #undef TARGET_KEEPS_VECTOR_ALIGNED_STACK #define TARGET_KEEPS_VECTOR_ALIGNED_STACK 1 /* On Darwin, the stack is 128-bit aligned at the point of every call. Failure to ensure this will lead to a crash in the system libraries or dynamic loader. */ #undef STACK_BOUNDARY #define STACK_BOUNDARY 128 #undef MAIN_STACK_BOUNDARY #define MAIN_STACK_BOUNDARY 128 /* Since we'll never want a stack boundary less aligned than 128 bits we need the extra work here otherwise bits of gcc get very grumpy when we ask for lower alignment. We could just reject values less than 128 bits for Darwin, but it's easier to up the alignment if it's below the minimum. */ #undef PREFERRED_STACK_BOUNDARY #define PREFERRED_STACK_BOUNDARY \ MAX (STACK_BOUNDARY, ix86_preferred_stack_boundary) /* We want -fPIC by default, unless we're using -static to compile for the kernel or some such. */ #undef CC1_SPEC #define CC1_SPEC "%(cc1_cpu) \ %= 11 && (n) <= 18 ? (n) + 1 \ : (n)) #undef REGISTER_SUBTARGET_PRAGMAS #define REGISTER_SUBTARGET_PRAGMAS() DARWIN_REGISTER_TARGET_PRAGMAS() #undef TARGET_SET_DEFAULT_TYPE_ATTRIBUTES #define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES darwin_set_default_type_attributes /* For 64-bit, we need to add 4 because @GOTPCREL is relative to the end of the instruction, but without the 4 we'd only have the right address for the start of the instruction. */ #undef ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \ if (TARGET_64BIT) \ { \ if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_pcrel) \ { \ fputs (ASM_LONG, FILE); \ assemble_name (FILE, XSTR (ADDR, 0)); \ fputs ("+4@GOTPCREL", FILE); \ goto DONE; \ } \ } \ else \ { \ if (ENCODING == ASM_PREFERRED_EH_DATA_FORMAT (2, 1)) \ { \ darwin_non_lazy_pcrel (FILE, ADDR); \ goto DONE; \ } \ } /* This needs to move since i386 uses the first flag and other flags are used in Mach-O. */ #undef MACHO_SYMBOL_FLAG_VARIABLE #define MACHO_SYMBOL_FLAG_VARIABLE ((SYMBOL_FLAG_MACH_DEP) << 3) #define SUBTARGET32_DEFAULT_CPU "i686"