📄 darwin.h
字号:
/* 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__"); \/* APPLE LOCAL mainline 2005-09-01 3449986 */ \ darwin_cpp_builtins (pfile); \ } \ 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; \ /* APPLE LOCAL begin constant cfstrings */ \ /* This just sets the default, SUBSUBTRAGET_OVERRIDE_OPTIONS will \ let the user override it. */ \ darwin_constant_cfstrings = (darwin_macosx_version_min \ && strverscmp (darwin_macosx_version_min, "10.2") >= 0); \ /* APPLE LOCAL end constant cfstrings */ \ 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 %qs", base); \ darwin_fix_and_continue = (base[0] != 'n'); \ } \ /* APPLE LOCAL begin longcall */ \ if (TARGET_64BIT && TARGET_MACHO) \ rs6000_longcall_switch = (char *)0; \ /* APPLE LOCAL end longcall */ \ } \ if (TARGET_64BIT && ! TARGET_POWERPC64) \ { \ target_flags |= MASK_POWERPC64; \ warning ("-m64 requires PowerPC64 architecture, enabling"); \ } \} while(0)/* APPLE LOCAL begin mainline 2006-02-24 4086777 */#define C_COMMON_OVERRIDE_OPTIONS do { \ /* On powerpc, __cxa_get_exception_ptr is available starting in the \ 10.4.6 libstdc++.dylib. */ \ if ((! darwin_macosx_version_min \ || strverscmp (darwin_macosx_version_min, "10.4.6") < 0) \ && flag_use_cxa_get_exception_ptr == 2) \ flag_use_cxa_get_exception_ptr = 0; \ /* APPLE LOCAL kexts */ \ SUBTARGET_C_COMMON_OVERRIDE_OPTIONS; \} while (0)/* APPLE LOCAL end mainline 2006-02-24 4086777 *//* 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 "\"/* APPLE LOCAL ignore -msse and -msse2 and other x86 options */"\%<msse %<msse2 %<msse3 %<march=pentium4 %<mcpu=pentium4 \%{g: %{!fno-eliminate-unused-debug-symbols: -feliminate-unused-debug-symbols }} \%{static: %{Zdynamic: %e conflicting code gen style switches are used}}\"/* APPLE LOCAL -fast and PIC code. */"\%{!static:%{!fast:%{!fastf:%{!fastcp:%{!mdynamic-no-pic:-fPIC}}}}}"#define DARWIN_SUBARCH_SPEC " \ %{m64: ppc64} \ %{!m64: \ %{mcpu=601:ppc601; \ mcpu=603:ppc603; \ mcpu=603e:ppc603; \ mcpu=604:ppc604; \ mcpu=604e:ppc604e; \ mcpu=740:ppc750; \ mcpu=750:ppc750; \ mcpu=G3:ppc750; \ mcpu=7400:ppc7400; \ mcpu=G4:ppc7400; \ mcpu=7450:ppc7450; \ mcpu=970:ppc970; \ mcpu=power4:ppc970; \ mcpu=G5:ppc970; \ :ppc}}"/* APPLE LOCAL begin mainline 2005-11-15 4271575 *//* crt2.o is at least partially required for 10.3.x and earlier. */#define DARWIN_CRT2_SPEC \ "%{!m64:%:version-compare(!> 10.4 mmacosx-version-min= crt2.o%s)}"/* APPLE LOCAL end mainline 2005-11-15 4271575 */#undef SUBTARGET_EXTRA_SPECS#define SUBTARGET_EXTRA_SPECS \ { "darwin_arch", "%{m64:ppc64;:ppc}" }, \ /* APPLE LOCAL mainline 2005-11-15 4271575 */ \ { "darwin_crt2", DARWIN_CRT2_SPEC }, \ { "darwin_subarch", DARWIN_SUBARCH_SPEC },/* Output a .machine directive. */#undef TARGET_ASM_FILE_START#define TARGET_ASM_FILE_START rs6000_darwin_file_start/* The "-faltivec" option should have been called "-maltivec" all along. -ffix-and-continue and -findirect-data is for compatibility for old compilers. */#define SUBTARGET_OPTION_TRANSLATE_TABLE \ { "-ffix-and-continue", "-mfix-and-continue" }, \ { "-findirect-data", "-mfix-and-continue" }, \ /* APPLE LOCAL AltiVec */ \ { "-faltivec", "-faltivec -mpim-altivec" }, \ { "-fno-altivec", "-mno-altivec" }, \ { "-Waltivec-long-deprecated", "-mwarn-altivec-long" }, \ { "-Wno-altivec-long-deprecated", "-mno-warn-altivec-long" }/* Make both r2 and r13 available for allocation. */#define FIXED_R2 0#define FIXED_R13 0/* Base register for access to local variables of the function. */#undef FRAME_POINTER_REGNUM#define FRAME_POINTER_REGNUM 30#undef RS6000_PIC_OFFSET_TABLE_REGNUM#define RS6000_PIC_OFFSET_TABLE_REGNUM 31/* APPLE LOCAL begin -pg fix *//* -pg has a problem which is normally concealed by -fPIC; either -mdynamic-no-pic or -static exposes the -pg problem, causing the crash. FSF gcc for Darwin also has this bug. The problem is that -pg causes several int registers to be saved and restored although they may not actually be used (config/rs6000/rs6000.c:first_reg_to_save()). In the rare case where none of them is actually used, a consistency check fails (correctly). This cannot happen with -fPIC because the PIC register (R31) is always "used" in the sense checked by the consistency check. The easy fix, here, is therefore to mark R31 always "used" whenever -pg is on. A better, but harder, fix would be to improve -pg's register-use logic along the lines suggested by comments in the function listed above. */#undef PIC_OFFSET_TABLE_REGNUM#define PIC_OFFSET_TABLE_REGNUM ((flag_pic || profile_flag) \ ? RS6000_PIC_OFFSET_TABLE_REGNUM \ : INVALID_REGNUM)/* APPLE LOCAL end -pg fix *//* Pad the outgoing args area to 16 bytes instead of the usual 8. */#undef STARTING_FRAME_OFFSET#define STARTING_FRAME_OFFSET \ (RS6000_ALIGN (current_function_outgoing_args_size, 16) \ + RS6000_VARARGS_AREA \ + RS6000_SAVE_AREA)#undef STACK_DYNAMIC_OFFSET#define STACK_DYNAMIC_OFFSET(FUNDECL) \ (RS6000_ALIGN (current_function_outgoing_args_size, 16) \ + (STACK_POINTER_OFFSET))/* These are used by -fbranch-probabilities */#define HOT_TEXT_SECTION_NAME "__TEXT,__text,regular,pure_instructions"#define UNLIKELY_EXECUTED_TEXT_SECTION_NAME \ "__TEXT,__unlikely,regular,pure_instructions"/* APPLE LOCAL begin long call hot cold *//* The following is used by hot/cold partitioning to determine whether to unconditional branches are "long enough" to span the distance between hot and cold sections (otherwise we have to use indirect jumps). It is set based on the -mlongcall flag. If -mlongcall is set, we use the indirect jumps (the macro below gets '0'); otherwise we use unconditional branches (the macro below gets '1'). */#define HAS_LONG_UNCOND_BRANCH (TARGET_LONG_BRANCH ? 0 : 1)/* APPLE LOCAL end long call hot cold *//* APPLE LOCAL begin long-branch *//* Define cutoff for using external functions to save floating point. For Darwin, use the function for more than a few registers. *//* APPLE LOCAL begin inline FP save/restore (radar 3414605) */#undef FP_SAVE_INLINE#define FP_SAVE_INLINE(FIRST_REG) \(optimize >= 3 \|| ((FIRST_REG) > 60 && (FIRST_REG) < 64) \|| TARGET_LONG_BRANCH)/* APPLE LOCAL end inline FP save/restore (radar 3414605) *//* Define cutoff for using external functions to save vector registers. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -