OSDN Git Service

* config/rs6000/x-rs6000: New file.
[pf3gnuchains/gcc-fork.git] / gcc / config / rs6000 / darwin.h
index 48be0e9..6c88757 100644 (file)
@@ -1,5 +1,5 @@
 /* Target definitions for PowerPC running Darwin (Mac OS X).
-   Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
+   Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2007
    Free Software Foundation, Inc.
    Contributed by Apple Computer Inc.
 
@@ -7,7 +7,7 @@
 
    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
+   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
@@ -16,9 +16,8 @@
    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, 51 Franklin Street, Fifth Floor, Boston,
-   MA 02110-1301, USA.  */
+   along with GCC; see the file COPYING3.  If not see
+   <http://www.gnu.org/licenses/>.  */
 
 #undef  TARGET_VERSION
 #define TARGET_VERSION fprintf (stderr, " (Darwin/PowerPC)");
 /* Translate config/rs6000/darwin.opt to config/darwin.h.  */
 #define TARGET_DYNAMIC_NO_PIC (TARGET_MACHO_DYNAMIC_NO_PIC)
 
-#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__"); \
-      darwin_cpp_builtins (pfile);             \
-    }                                           \
+#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__");                \
+      darwin_cpp_builtins (pfile);                     \
+    }                                                  \
   while (0)
 
-
-#define SUBTARGET_OVERRIDE_OPTIONS                                     \
-do {                                                                   \
-  /* The Darwin ABI always includes AltiVec, can't be (validly) turned \
-     off.  */                                                          \
-  rs6000_altivec_abi = 1;                                              \
-  TARGET_ALTIVEC_VRSAVE = 1;                                           \
-  if (DEFAULT_ABI == ABI_DARWIN)                                       \
-  {                                                                    \
-    if (MACHO_DYNAMIC_NO_PIC_P)                                                \
-      {                                                                        \
-        if (flag_pic)                                                  \
-            warning (0, "-mdynamic-no-pic overrides -fpic or -fPIC");  \
-        flag_pic = 0;                                                  \
-      }                                                                        \
-    else if (flag_pic == 1)                                            \
-      {                                                                        \
-        flag_pic = 2;                                                  \
-      }                                                                        \
-  }                                                                    \
-  if (TARGET_64BIT && ! TARGET_POWERPC64)                              \
-    {                                                                  \
-      target_flags |= MASK_POWERPC64;                                  \
-      warning (0, "-m64 requires PowerPC64 architecture, enabling");   \
-    }                                                                  \
-  if (flag_mkernel)                                                    \
-    {                                                                  \
-      rs6000_default_long_calls = 1;                                   \
-      target_flags |= MASK_SOFT_FLOAT;                                 \
-    }                                                                  \
-                                                                       \
-  /* Make -m64 imply -maltivec.  Darwin's 64-bit ABI includes          \
-     Altivec.  */                                                      \
-  if (!flag_mkernel && !flag_apple_kext                                        \
-      && TARGET_64BIT                                                  \
-      && ! (target_flags_explicit & MASK_ALTIVEC))                     \
-    target_flags |= MASK_ALTIVEC;                                      \
-                                                                       \
-  /* Unless the user (not the configurer) has explicitly overridden    \
-     it with -mcpu=G3 or -mno-altivec, then 10.5+ targets default to   \
-     G4 unless targetting the kernel.  */                              \
-  if (!flag_mkernel                                                    \
-      && !flag_apple_kext                                              \
-      && darwin_macosx_version_min                                     \
-      && strverscmp (darwin_macosx_version_min, "10.5") >= 0           \
-      && ! (target_flags_explicit & MASK_ALTIVEC)                      \
-      && ! rs6000_select[1].string)                                    \
-    {                                                                  \
-      target_flags |= MASK_ALTIVEC;                                    \
-    }                                                                  \
-} while(0)
+#define SUBTARGET_OVERRIDE_OPTIONS darwin_rs6000_override_options ()
 
 #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)                \
+  if (strverscmp (darwin_macosx_version_min, "10.4.6") < 0             \
       && flag_use_cxa_get_exception_ptr == 2)                          \
     flag_use_cxa_get_exception_ptr = 0;                                        \
   if (flag_mkernel)                                                    \
@@ -142,8 +90,10 @@ do {                                                                        \
    the kernel or some such.  */
 
 #define CC1_SPEC "\
+  %(cc1_cpu) \
   %{g: %{!fno-eliminate-unused-debug-symbols: -feliminate-unused-debug-symbols }} \
   %{static: %{Zdynamic: %e conflicting code gen style switches are used}}\
+  %{!mmacosx-version-min=*:-mmacosx-version-min=%(darwin_minversion)} \
   %{!mkernel:%{!static:%{!mdynamic-no-pic:-fPIC}}}"
 
 #define DARWIN_ARCH_SPEC "%{m64:ppc64;:ppc}"
@@ -171,6 +121,17 @@ do {                                                                       \
 #define DARWIN_CRT2_SPEC \
   "%{!m64:%:version-compare(!> 10.4 mmacosx-version-min= crt2.o%s)}"
 
+/* Determine a minimum version based on compiler options.  */
+#define DARWIN_MINVERSION_SPEC                                 \
+  "%{m64:%{fgnu-runtime:10.4;                                  \
+          ,objective-c|,objc-cpp-output:10.5;                  \
+          ,objective-c-header:10.5;                            \
+          ,objective-c++|,objective-c++-cpp-output:10.5;       \
+          ,objective-c++-header|,objc++-cpp-output:10.5;       \
+          :10.4};                                              \
+     shared-libgcc:10.3;                                       \
+     :10.1}"
+
 #undef SUBTARGET_EXTRA_SPECS
 #define SUBTARGET_EXTRA_SPECS                  \
   DARWIN_EXTRA_SPECS                            \
@@ -281,8 +242,6 @@ do {                                                                        \
 
 /* This says how to output an assembler line to define a global common
    symbol.  */
-/* ? */
-#undef  ASM_OUTPUT_ALIGNED_COMMON
 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)                   \
   do {                                                                 \
     unsigned HOST_WIDE_INT _new_size = SIZE;                           \
@@ -394,14 +353,11 @@ do {                                                                      \
    ? GENERAL_REGS                                              \
    : (CLASS))
 
-/* Fix for emit_group_load (): force large constants to be pushed via regs.  */
-#define ALWAYS_PUSH_CONSTS_USING_REGS_P                1
-
 /* Compute field alignment.  This is similar to the version of the
    macro in the Apple version of GCC, except that version supports
    'mac68k' alignment, and that version uses the computed alignment
    always for the first field of a structure.  The first-field
-   behaviour is dealt with by
+   behavior is dealt with by
    darwin_rs6000_special_round_type_align.  */
 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED)    \
   (TARGET_ALIGN_NATURAL ? (COMPUTED)           \
@@ -449,12 +405,10 @@ do {                                                                      \
 #include <stdbool.h>
 #endif
 
-#ifndef __LP64__
+#if !defined(__LP64__) && !defined(DARWIN_LIBSYSTEM_HAS_UNWIND)
 #define MD_UNWIND_SUPPORT "config/rs6000/darwin-unwind.h"
 #endif
 
-#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 5 nops so
    that gdb may insert code to redirect them, and for data to be
@@ -473,8 +427,7 @@ do {                                                                        \
 #undef TARGET_C99_FUNCTIONS
 #define TARGET_C99_FUNCTIONS                                   \
   (TARGET_64BIT                                                        \
-   || (darwin_macosx_version_min                               \
-       && strverscmp (darwin_macosx_version_min, "10.3") >= 0))
+   || strverscmp (darwin_macosx_version_min, "10.3") >= 0)
 
 /* When generating kernel code or kexts, we don't use Altivec by
    default, as kernel code doesn't save/restore those registers.  */