/* Target definitions for PowerPC running Darwin (Mac OS X). Copyright (C) 1997, 2000, 2001, 2003, 2004 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 2, 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 COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #undef TARGET_VERSION #define TARGET_VERSION fprintf (stderr, " (Darwin/PowerPC)"); /* The "Darwin ABI" is mostly like AIX, but with some key differences. */ #define DEFAULT_ABI ABI_DARWIN /* The object file format is Mach-O. */ #define TARGET_OBJECT_FORMAT OBJECT_MACHO /* We're not ever going to do TOCs. */ #define TARGET_TOC 0 #define TARGET_NO_TOC 1 /* Override the default rs6000 definition. */ #undef PTRDIFF_TYPE #define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int") /* Darwin switches. */ /* Use dynamic-no-pic codegen (no picbase reg; not suitable for shlibs.) */ #define MASK_MACHO_DYNAMIC_NO_PIC 0x00800000 #define TARGET_DYNAMIC_NO_PIC (target_flags & MASK_MACHO_DYNAMIC_NO_PIC) /* Handle #pragma weak and #pragma pack. */ #define HANDLE_SYSV_PRAGMA 1 #define TARGET_OS_CPP_BUILTINS() \ do \ { \ if (!TARGET_64BIT) builtin_define ("__ppc__"); \ if (TARGET_64BIT) builtin_define ("__ppc64__"); \ builtin_define ("__POWERPC__"); \ builtin_define ("__NATURAL_ALIGNMENT__"); \ builtin_define ("__MACH__"); \ builtin_define ("__APPLE__"); \ } \ while (0) /* */ #undef SUBTARGET_SWITCHES #define SUBTARGET_SWITCHES \ { "64", MASK_64BIT | MASK_POWERPC64, \ N_("Generate 64-bit code") }, \ { "32", - (MASK_64BIT | MASK_POWERPC64), \ N_("Generate 32-bit code") }, \ {"dynamic-no-pic", MASK_MACHO_DYNAMIC_NO_PIC, \ N_("Generate code suitable for executables (NOT shared libs)")}, \ {"no-dynamic-no-pic", -MASK_MACHO_DYNAMIC_NO_PIC, ""}, /* The Darwin ABI always includes AltiVec, can't be (validly) turned off. */ #define SUBTARGET_OVERRIDE_OPTIONS \ do { \ rs6000_altivec_abi = 1; \ rs6000_altivec_vrsave = 1; \ if (DEFAULT_ABI == ABI_DARWIN) \ { \ if (MACHO_DYNAMIC_NO_PIC_P) \ { \ if (flag_pic) \ warning ("-mdynamic-no-pic overrides -fpic or -fPIC"); \ flag_pic = 0; \ } \ else if (flag_pic == 1) \ { \ /* Darwin doesn't support -fpic. */ \ warning ("-fpic is not supported; -fPIC assumed"); \ flag_pic = 2; \ } \ \ /* Handle -mfix-and-continue. */ \ if (darwin_fix_and_continue_switch) \ { \ const char *base = darwin_fix_and_continue_switch; \ while (base[-1] != 'm') base--; \ \ if (*darwin_fix_and_continue_switch != '\0') \ error ("invalid option `%s'", base); \ darwin_fix_and_continue = (base[0] != 'n'); \ } \ } \ if (TARGET_64BIT && ! TARGET_POWERPC64) \ { \ target_flags |= MASK_POWERPC64; \ warning ("-m64 requires PowerPC64 architecture, enabling"); \ } \ } while(0) /* Darwin has 128-bit long double support in libc in 10.4 and later. Default to 128-bit long doubles even on earlier platforms for ABI consistency; arithmetic will work even if libc and libm support is not available. */ #define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128 /* We want -fPIC by default, unless we're using -static to compile for the kernel or some such. */ #define CC1_SPEC "\ %{gused: -g -feliminate-unused-debug-symbols % #endif #define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS) \ { \ extern bool _Unwind_fallback_frame_state_for \ (struct _Unwind_Context *context, _Unwind_FrameState *fs); \ \ if (_Unwind_fallback_frame_state_for (CONTEXT, FS)) \ goto SUCCESS; \ } #define HAS_MD_FALLBACK_FRAME_STATE_FOR 1 /* True, iff we're generating fast turn around debugging code. When true, we arrange for function prologues to start with 4 nops so that gdb may insert code to redirect them, and for data to accessed indirectly. The runtime uses this indirection to forward references for data to the original instance of that data. */ #define TARGET_FIX_AND_CONTINUE (darwin_fix_and_continue)