OSDN Git Service

* opt-functions.awk (var_type): New function.
[pf3gnuchains/gcc-fork.git] / gcc / config / sparc / linux64.h
index a70cd24..3a4613b 100644 (file)
@@ -1,25 +1,42 @@
 /* Definitions for 64-bit SPARC running Linux-based GNU systems with ELF.
-   Copyright 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998, 2000, 2002, 2003, 2004, 2005
+   Free Software Foundation, Inc.
    Contributed by David S. Miller (davem@caip.rutgers.edu)
 
-This file is part of GNU CC.
+This file is part of GCC.
 
-GNU CC is free software; you can redistribute it and/or modify
+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.
 
-GNU CC is distributed in the hope that it will be useful,
+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 GNU CC; see the file COPYING.  If not, write to
+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.  */
 
-#define LINUX_DEFAULT_ELF
+#define TARGET_OS_CPP_BUILTINS()               \
+  do                                           \
+    {                                          \
+       builtin_define_std ("unix");            \
+       builtin_define_std ("linux");           \
+       builtin_define ("_LONGLONG");           \
+       builtin_define ("__gnu_linux__");       \
+       builtin_assert ("system=linux");        \
+       builtin_assert ("system=unix");         \
+       builtin_assert ("system=posix");        \
+       if (flag_pic)                           \
+         {                                     \
+               builtin_define ("__PIC__");     \
+               builtin_define ("__pic__");     \
+         }                                     \
+    }                                          \
+  while (0)
 
 /* Don't assume anything about the header files.  */
 #define NO_IMPLICIT_EXTERN_C
@@ -27,7 +44,9 @@ Boston, MA 02111-1307, USA.  */
 #undef MD_EXEC_PREFIX
 #undef MD_STARTFILE_PREFIX
 
-#if TARGET_CPU_DEFAULT == TARGET_CPU_v9 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
+#if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
+    || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc \
+    || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc3
 /* A 64 bit v9 compiler with stack-bias,
    in a Medium/Low code model environment.  */
 
@@ -43,8 +62,7 @@ Boston, MA 02111-1307, USA.  */
 #ifdef SPARC_BI_ARCH
 
 #undef CPP_ARCH32_SPEC
-#define CPP_ARCH32_SPEC "%{mlong-double-128:-D__LONG_DOUBLE_128__} \
--D__GCC_NEW_VARARGS__ -Acpu=sparc -Amachine=sparc"
+#define CPP_ARCH32_SPEC "%{mlong-double-128:-D__LONG_DOUBLE_128__}"
 
 #endif
 
@@ -55,36 +73,14 @@ Boston, MA 02111-1307, USA.  */
    
 #undef  STARTFILE_SPEC
 
-#define STARTFILE_SPEC32 \
-  "%{!shared: \
-     %{pg:/usr/lib/gcrt1.o%s} %{!pg:%{p:/usr/lib/gcrt1.o%s} %{!p:/usr/lib/crt1.o%s}}}\
-   /usr/lib/crti.o%s %{static:crtbeginT.o%s}\
-   %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}"
-
-#define STARTFILE_SPEC64 \
-  "%{!shared: \
-     %{pg:/usr/lib64/gcrt1.o%s} %{!pg:%{p:/usr/lib64/gcrt1.o%s} %{!p:/usr/lib64/crt1.o%s}}}\
-   /usr/lib64/crti.o%s %{static:crtbeginT.o%s}\
-   %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}"
-
-#ifdef SPARC_BI_ARCH
-
-#if DEFAULT_ARCH32_P
-#define STARTFILE_SPEC "\
-%{m32:" STARTFILE_SPEC32 "} \
-%{m64:" STARTFILE_SPEC64 "} \
-%{!m32:%{!m64:" STARTFILE_SPEC32 "}}"
-#else
-#define STARTFILE_SPEC "\
-%{m32:" STARTFILE_SPEC32 "} \
-%{m64:" STARTFILE_SPEC64 "} \
-%{!m32:%{!m64:" STARTFILE_SPEC64 "}}"
-#endif
-
+#ifdef HAVE_LD_PIE
+#define STARTFILE_SPEC \
+  "%{!shared:%{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
+   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbeginS.o%s}"
 #else
-
-#define STARTFILE_SPEC STARTFILE_SPEC64
-
+#define STARTFILE_SPEC \
+  "%{!shared:%{pg|p:gcrt1.o%s;:crt1.o%s}}\
+   crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbeginS.o%s}"
 #endif
 
 /* Provide a ENDFILE_SPEC appropriate for GNU/Linux.  Here we tack on
@@ -95,36 +91,9 @@ Boston, MA 02111-1307, USA.  */
 
 #undef  ENDFILE_SPEC
 
-#define ENDFILE_SPEC32 \
-  "%{!shared:crtend.o%s} %{shared:crtendS.o%s} /usr/lib/crtn.o%s"
-
-#define ENDFILE_SPEC64 \
-  "%{!shared:crtend.o%s} %{shared:crtendS.o%s} /usr/lib64/crtn.o%s"
-  
-#define ENDFILE_SPEC_COMMON \
-  "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
-
-#ifdef SPARC_BI_ARCH
-
-#if DEFAULT_ARCH32_P
-#define ENDFILE_SPEC "\
-%{m32:" ENDFILE_SPEC32 "} \
-%{m64:" ENDFILE_SPEC64 "} \
-%{!m32:%{!m64:" ENDFILE_SPEC32 "}} " \
-ENDFILE_SPEC_COMMON
-#else
-#define ENDFILE_SPEC "\
-%{m32:" ENDFILE_SPEC32 "} \
-%{m64:" ENDFILE_SPEC64 "} \
-%{!m32:%{!m64:" ENDFILE_SPEC64 "}} " \
-ENDFILE_SPEC_COMMON
-#endif
-
-#else
-
-#define ENDFILE_SPEC ENDFILE_SPEC64 " " ENDFILE_SPEC_COMMON
-
-#endif
+#define ENDFILE_SPEC \
+  "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\
+   %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
 
 /* The GNU C++ standard library requires that these macros be defined.  */
 #undef CPLUSPLUS_CPP_SPEC
@@ -137,11 +106,6 @@ ENDFILE_SPEC_COMMON
 #undef SPARC_DEFAULT_CMODEL
 #define SPARC_DEFAULT_CMODEL CM_MEDLOW
 
-#undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES                                                 \
-{"long-double-64", -MASK_LONG_DOUBLE_128, N_("Use 64 bit long doubles") },  \
-{"long-double-128", MASK_LONG_DOUBLE_128, N_("Use 128 bit long doubles") },
-
 #undef WCHAR_TYPE
 #define WCHAR_TYPE "int"
 
@@ -149,14 +113,10 @@ ENDFILE_SPEC_COMMON
 #define WCHAR_TYPE_SIZE 32
 
 /* Define for support of TFmode long double.
-   Sparc ABI says that long double is 4 words.  */
+   SPARC ABI says that long double is 4 words.  */
 #undef LONG_DOUBLE_TYPE_SIZE
 #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
 
-/* Constant which presents upper bound of the above value.  */
-#undef MAX_LONG_DOUBLE_TYPE_SIZE
-#define MAX_LONG_DOUBLE_TYPE_SIZE 128
-
 /* Define this to set long double type size to use in libgcc2.c, which can
    not depend on target_flags.  */
 #if defined(__arch64__) || defined(__LONG_DOUBLE_128__)
@@ -165,22 +125,17 @@ ENDFILE_SPEC_COMMON
 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
 #endif
 
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-D__ELF__ -Dunix -D_LONGLONG -D__sparc__ -D__gnu_linux__ -Dlinux -Asystem=unix -Asystem=posix"
-
 #undef CPP_SUBTARGET_SPEC
 #define CPP_SUBTARGET_SPEC "\
-%{fPIC:-D__PIC__ -D__pic__} \
-%{fpic:-D__PIC__ -D__pic__} \
 %{posix:-D_POSIX_SOURCE} \
 %{pthread:-D_REENTRANT} \
 "
 
 #undef LIB_SPEC
 #define LIB_SPEC \
-  "%{shared: -lc} \
-   %{!shared: %{mieee-fp:-lieee} %{pthread:-lpthread} \
-     %{profile:-lc_p} %{!profile: -lc}}"
+  "%{pthread:-lpthread} \
+   %{shared:-lc} \
+   %{!shared: %{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}"
 
 /* Provide a LINK_SPEC appropriate for GNU/Linux.  Here we provide support
    for the special GCC options -static and -shared, which allow us to
@@ -267,6 +222,27 @@ ENDFILE_SPEC_COMMON
 "
 #endif
 
+/* Support for a compile-time default CPU, et cetera.  The rules are:
+   --with-cpu is ignored if -mcpu is specified.
+   --with-tune is ignored if -mtune is specified.
+   --with-float is ignored if -mhard-float, -msoft-float, -mfpu, or -mno-fpu
+     are specified.
+   In the SPARC_BI_ARCH compiler we cannot pass %{!mcpu=*:-mcpu=%(VALUE)}
+   here, otherwise say -mcpu=v7 would be passed even when -m64.
+   CC1_SPEC above takes care of this instead.  */
+#undef OPTION_DEFAULT_SPECS
+#if DEFAULT_ARCH32_P
+#define OPTION_DEFAULT_SPECS \
+  {"cpu", "%{!m64:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
+  {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
+  {"float", "%{!msoft-float:%{!mhard-float:%{!fpu:%{!no-fpu:-m%(VALUE)-float}}}}" }
+#else
+#define OPTION_DEFAULT_SPECS \
+  {"cpu", "%{!m32:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
+  {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
+  {"float", "%{!msoft-float:%{!mhard-float:%{!fpu:%{!no-fpu:-m%(VALUE)-float}}}}" }
+#endif
+
 #if DEFAULT_ARCH32_P
 #define MULTILIB_DEFAULTS { "m32" }
 #else
@@ -300,7 +276,7 @@ ENDFILE_SPEC_COMMON
 %{T} \
 %{Ym,*} \
 %{Wa,*:%*} \
--s %{fpic:-K PIC} %{fPIC:-K PIC} \
+-s %{fpic|fPIC|fpie|fPIE:-K PIC} \
 %{mlittle-endian:-EL} \
 %(asm_cpu) %(asm_arch) %(asm_relax)"
 
@@ -308,13 +284,6 @@ ENDFILE_SPEC_COMMON
 #undef DBX_REGISTER_NUMBER
 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
 
-/* System V Release 4 uses DWARF debugging info.  Buf DWARF1 doesn't do
-   64-bit anything, so we use DWARF2.  */
-
-#undef DWARF_DEBUGGING_INFO
-#define DWARF2_DEBUGGING_INFO 1
-#define DBX_DEBUGGING_INFO 1
-
 #undef ASM_OUTPUT_ALIGNED_LOCAL
 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN)              \
 do {                                                                   \
@@ -330,20 +299,6 @@ do {                                                                       \
 #undef  LOCAL_LABEL_PREFIX
 #define LOCAL_LABEL_PREFIX  "."
 
-/* This is how to output a definition of an internal numbered label where
-   PREFIX is the class of label and NUM is the number within the class.  */
-
-#undef  ASM_OUTPUT_INTERNAL_LABEL
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)     \
-  fprintf (FILE, ".L%s%d:\n", PREFIX, NUM)
-
-/* This is how to output a reference to an internal numbered label where
-   PREFIX is the class of label and NUM is the number within the class.  */
-
-#undef  ASM_OUTPUT_INTERNAL_LABELREF
-#define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM)  \
-  fprintf (FILE, ".L%s%d", PREFIX, NUM)
-
 /* This is how to store into the string LABEL
    the symbol_ref name of an internal numbered label where
    PREFIX is the class of label and NUM is the number within the class.
@@ -362,10 +317,20 @@ do {                                                                      \
 
 /* #define DWARF_OFFSET_SIZE PTR_SIZE */
 
+#undef DITF_CONVERSION_LIBFUNCS
+#define DITF_CONVERSION_LIBFUNCS 1
+
 #if defined(HAVE_LD_EH_FRAME_HDR)
 #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
 #endif
 \f
+#ifdef HAVE_AS_TLS
+#undef TARGET_SUN_TLS
+#undef TARGET_GNU_TLS
+#define TARGET_SUN_TLS 0
+#define TARGET_GNU_TLS 1
+#endif
+\f
 /* Don't be different from other Linux platforms in this regard.  */
 #define HANDLE_PRAGMA_PACK_PUSH_POP
 
@@ -373,121 +338,28 @@ do {                                                                     \
 #undef CTORS_SECTION_ASM_OP
 #undef DTORS_SECTION_ASM_OP
 
-/* Do code reading to identify a signal frame, and set the frame
-   state data appropriately.  See unwind-dw2.c for the structs.  */
-
-/* Handle multilib correctly.  */
-#if defined(__arch64__)
-/* 64-bit Sparc version */
-#define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS)              \
-  do {                                                                 \
-    unsigned int *pc_ = (CONTEXT)->ra;                                 \
-    long new_cfa_, i_;                                                 \
-    long regs_off_, fpu_save_off_;                                     \
-    long this_cfa_, fpu_save_;                                         \
-                                                                       \
-    if (pc_[0] != 0x82102065           /* mov NR_rt_sigreturn, %g1 */  \
-        || pc_[1] != 0x91d0206d)               /* ta 0x6d */           \
-      break;                                                           \
-    regs_off_ = 192 + 128;                                             \
-    fpu_save_off_ = regs_off_ + (16 * 8) + (3 * 8) + (2 * 4);          \
-    this_cfa_ = (long) (CONTEXT)->cfa;                                 \
-    new_cfa_ = *(long *)(((CONTEXT)->cfa) + (regs_off_ + (14 * 8)));   \
-    new_cfa_ += 2047; /* Stack bias */                                 \
-    fpu_save_ = *(long *)((this_cfa_) + (fpu_save_off_));              \
-    (FS)->cfa_how = CFA_REG_OFFSET;                                    \
-    (FS)->cfa_reg = 14;                                                        \
-    (FS)->cfa_offset = new_cfa_ - (long) (CONTEXT)->cfa;               \
-    for (i_ = 1; i_ < 16; ++i_)                                                \
-      {                                                                        \
-       (FS)->regs.reg[i_].how = REG_SAVED_OFFSET;                      \
-       (FS)->regs.reg[i_].loc.offset =                                 \
-         this_cfa_ + (regs_off_ + (i_ * 8)) - new_cfa_;                \
-      }                                                                        \
-    for (i_ = 0; i_ < 16; ++i_)                                                \
-      {                                                                        \
-       (FS)->regs.reg[i_ + 16].how = REG_SAVED_OFFSET;                 \
-       (FS)->regs.reg[i_ + 16].loc.offset =                            \
-         this_cfa_ + (i_ * 8) - new_cfa_;                              \
-      }                                                                        \
-    if (fpu_save_)                                                     \
-      {                                                                        \
-       for (i_ = 0; i_ < 64; ++i_)                                     \
-         {                                                             \
-            if (i_ > 32 && (i_ & 0x1))                                 \
-              continue;                                                        \
-           (FS)->regs.reg[i_ + 32].how = REG_SAVED_OFFSET;             \
-           (FS)->regs.reg[i_ + 32].loc.offset =                        \
-             (fpu_save_ + (i_ * 4)) - new_cfa_;                        \
-         }                                                             \
-      }                                                                        \
-    /* Stick return address into %g0, same trick Alpha uses.  */       \
-    (FS)->regs.reg[0].how = REG_SAVED_OFFSET;                          \
-    (FS)->regs.reg[0].loc.offset =                                     \
-      this_cfa_ + (regs_off_ + (16 * 8) + 8) - new_cfa_;               \
-    (FS)->retaddr_column = 0;                                          \
-    goto SUCCESS;                                                      \
-  } while (0)
-#else
-/* 32-bit Sparc version */
-#define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS)              \
-  do {                                                                 \
-    unsigned int *pc_ = (CONTEXT)->ra;                                 \
-    int new_cfa_, i_, oldstyle_;                                       \
-    int regs_off_, fpu_save_off_;                                      \
-    int fpu_save_, this_cfa_;                                          \
-                                                                       \
-    if (pc_[1] != 0x91d02010)          /* ta 0x10 */                   \
-      break;                                                           \
-    if (pc_[0] == 0x821020d8)          /* mov NR_sigreturn, %g1 */     \
-      oldstyle_ = 1;                                                   \
-    else if (pc_[0] == 0x82102065)     /* mov NR_rt_sigreturn, %g1 */  \
-      oldstyle_ = 0;                                                   \
-    else                                                               \
-      break;                                                           \
-    if (oldstyle_)                                                     \
-      {                                                                        \
-        regs_off_ = 96;                                                        \
-        fpu_save_off_ = regs_off_ + (4 * 4) + (16 * 4);                        \
-      }                                                                        \
-    else                                                               \
-      {                                                                        \
-        regs_off_ = 96 + 128;                                          \
-        fpu_save_off_ = regs_off_ + (4 * 4) + (16 * 4) + (2 * 4);      \
-      }                                                                        \
-    this_cfa_ = (int) (CONTEXT)->cfa;                                  \
-    new_cfa_ = *(int *)(((CONTEXT)->cfa) + (regs_off_+(4*4)+(14 * 4)));        \
-    fpu_save_ = *(int *)((this_cfa_) + (fpu_save_off_));               \
-    (FS)->cfa_how = CFA_REG_OFFSET;                                    \
-    (FS)->cfa_reg = 14;                                                        \
-    (FS)->cfa_offset = new_cfa_ - (int) (CONTEXT)->cfa;                        \
-    for (i_ = 1; i_ < 16; ++i_)                                                \
-      {                                                                        \
-        if (i_ == 14)                                                  \
-          continue;                                                    \
-       (FS)->regs.reg[i_].how = REG_SAVED_OFFSET;                      \
-       (FS)->regs.reg[i_].loc.offset =                                 \
-          this_cfa_ + (regs_off_+(4 * 4)+(i_ * 4)) - new_cfa_;         \
-      }                                                                        \
-    for (i_ = 0; i_ < 16; ++i_)                                                \
-      {                                                                        \
-       (FS)->regs.reg[i_ + 16].how = REG_SAVED_OFFSET;                 \
-       (FS)->regs.reg[i_ + 16].loc.offset =                            \
-         this_cfa_ + (i_ * 4) - new_cfa_;                              \
-      }                                                                        \
-    if (fpu_save_)                                                     \
-      {                                                                        \
-       for (i_ = 0; i_ < 32; ++i_)                                     \
-         {                                                             \
-           (FS)->regs.reg[i_ + 32].how = REG_SAVED_OFFSET;             \
-           (FS)->regs.reg[i_ + 32].loc.offset =                        \
-             (fpu_save_ + (i_ * 4)) - new_cfa_;                        \
-         }                                                             \
-      }                                                                        \
-    /* Stick return address into %g0, same trick Alpha uses.  */       \
-    (FS)->regs.reg[0].how = REG_SAVED_OFFSET;                          \
-    (FS)->regs.reg[0].loc.offset = this_cfa_+(regs_off_+4)-new_cfa_;   \
-    (FS)->retaddr_column = 0;                                          \
-    goto SUCCESS;                                                      \
-  } while (0)
+/* Determine whether the the entire c99 runtime is present in the
+   runtime library.  */
+#define TARGET_C99_FUNCTIONS 1
+
+#define TARGET_HAS_F_SETLKW
+
+#undef LINK_GCC_C_SEQUENCE_SPEC
+#define LINK_GCC_C_SEQUENCE_SPEC \
+  "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
+
+/* Use --as-needed -lgcc_s for eh support.  */
+#ifdef HAVE_LD_AS_NEEDED
+#define USE_LD_AS_NEEDED 1
 #endif
+
+#define MD_UNWIND_SUPPORT "config/sparc/linux-unwind.h"
+
+/* Linux currently uses RMO in uniprocessor mode, which is equivalent to
+   TMO, and TMO in multiprocessor mode.  But they reserve the right to
+   change their minds.  */
+#undef SPARC_RELAXED_ORDERING
+#define SPARC_RELAXED_ORDERING true
+
+#undef NEED_INDICATE_EXEC_STACK
+#define NEED_INDICATE_EXEC_STACK 1