OSDN Git Service

* config/i386/i386.c (ix86_data_alignment): Don't specify an
[pf3gnuchains/gcc-fork.git] / gcc / config / mips / linux.h
index 419d33a..303ce1d 100644 (file)
@@ -1,25 +1,23 @@
 /* Definitions for MIPS running Linux-based GNU systems with ELF format.
-   Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
 
-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
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
-
-#include "mips/mips.h"
-#include "mips/abi64.h"
+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.  */
 
 #undef WCHAR_TYPE
 #define WCHAR_TYPE "int"
@@ -36,79 +34,10 @@ Boston, MA 02111-1307, USA.  */
    used.  */
 #define BSS_SECTION_ASM_OP     "\t.section\t.bss"
 
-#define SBSS_SECTION_ASM_OP    "\t.section .sbss"
-
-/* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
-   separate, explicit argument.  If you define this macro, it is used
-   in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
-   handling the required alignment of the variable.  The alignment is
-   specified as the number of bits.
-
-   Try to use function `asm_output_aligned_bss' defined in file
-   `varasm.c' when defining this macro.  */
-#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN)  \
-do {                                                           \
-  ASM_GLOBALIZE_LABEL (FILE, NAME);                            \
-  if (SIZE > 0 && SIZE <= mips_section_threshold)              \
-    sbss_section ();                                           \
-  else                                                         \
-    bss_section ();                                            \
-  ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT)); \
-  last_assemble_variable_decl = DECL;                          \
-  ASM_DECLARE_OBJECT_NAME (FILE, NAME, DECL);                  \
-  ASM_OUTPUT_SKIP (FILE, SIZE ? SIZE : 1);                     \
-} while (0)
-
-/* These macros generate the special .type and .size directives which
-   are used to set the corresponding fields of the linker symbol table
-   entries in an ELF object file under SVR4.  These macros also output
-   the starting labels for the relevant functions/objects.  */
-
-/* Write the extra assembler code needed to declare an object properly.  */
+#define ASM_OUTPUT_ALIGNED_BSS mips_output_aligned_bss
 
 #undef ASM_DECLARE_OBJECT_NAME
-#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)              \
-  do {                                                         \
-    fprintf (FILE, "%s", TYPE_ASM_OP);                         \
-    assemble_name (FILE, NAME);                                        \
-    putc (',', FILE);                                          \
-    fprintf (FILE, TYPE_OPERAND_FMT, "object");                        \
-    putc ('\n', FILE);                                         \
-    size_directive_output = 0;                                 \
-    if (!flag_inhibit_size_directive && DECL_SIZE (DECL))      \
-      {                                                                \
-       size_directive_output = 1;                              \
-       fprintf (FILE, "%s", SIZE_ASM_OP);                      \
-       assemble_name (FILE, NAME);                             \
-       fprintf (FILE, ",");                                    \
-       fprintf (FILE, HOST_WIDE_INT_PRINT_DEC,                 \
-                int_size_in_bytes (TREE_TYPE (DECL)));         \
-       fprintf (FILE, "\n");                                   \
-      }                                                                \
-    mips_declare_object (FILE, NAME, "", ":\n", 0);            \
-  } while (0)
-
-#define TARGET_ASM_UNIQUE_SECTION  mips_unique_section
-
-/* A list of other sections which the compiler might be "in" at any
-   given time.  */
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_sdata, in_sbss
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS                                         \
-  SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \
-  SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP)
-
-#define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP)                        \
-void FN ()                                                     \
-{                                                              \
-  if (in_section != ENUM)                                      \
-    {                                                          \
-      fprintf (asm_out_file, "%s\n", OP);                      \
-      in_section = ENUM;                                       \
-    }                                                          \
-}
+#define ASM_DECLARE_OBJECT_NAME mips_declare_object_name
 
 #undef TARGET_VERSION
 #if TARGET_ENDIAN_DEFAULT == 0
@@ -120,70 +49,54 @@ void FN ()                                                 \
 #undef MD_EXEC_PREFIX
 #undef MD_STARTFILE_PREFIX
 
-/* Required to keep collect2.c happy */
-#undef OBJECT_FORMAT_COFF
-
 /* If we don't set MASK_ABICALLS, we can't default to PIC.  */
 #undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_ABICALLS|MASK_GAS)
+#define TARGET_DEFAULT MASK_ABICALLS
 
-/* Specify predefined symbols in preprocessor.  */
-#undef CPP_PREDEFINES
-#if TARGET_ENDIAN_DEFAULT == 0
-#define CPP_PREDEFINES "-DMIPSEL -D_MIPSEL -Dunix -Dmips -D_mips \
--DR3000 -D_R3000 -D__gnu_linux__ -Dlinux -Asystem=posix -Acpu=mips \
--Amachine=mips -D__ELF__ -D__PIC__ -D__pic__"
-#else
-#define CPP_PREDEFINES "-DMIPSEB -D_MIPSEB -Dunix -Dmips -D_mips \
--DR3000 -D_R3000 -D__gnu_linux__ -Dlinux -Asystem=posix -Acpu=mips \
--Amachine=mips -D__ELF__ -D__PIC__ -D__pic__"
-#endif
+#define TARGET_OS_CPP_BUILTINS()                               \
+  do {                                                         \
+    LINUX_TARGET_OS_CPP_BUILTINS();                            \
+    /* The GNU C++ standard library requires this.  */         \
+    if (c_dialect_cxx ())                                      \
+      builtin_define ("_GNU_SOURCE");                          \
+                                                               \
+    if (mips_abi == ABI_N32)                                   \
+      {                                                                \
+        builtin_define ("_ABIN32=2");                          \
+        builtin_define ("_MIPS_SIM=_ABIN32");                  \
+        builtin_define ("_MIPS_SZLONG=32");                    \
+        builtin_define ("_MIPS_SZPTR=32");                     \
+      }                                                                \
+    else if (mips_abi == ABI_64)                               \
+      {                                                                \
+        builtin_define ("_ABI64=3");                           \
+        builtin_define ("_MIPS_SIM=_ABI64");                   \
+        builtin_define ("_MIPS_SZLONG=64");                    \
+        builtin_define ("_MIPS_SZPTR=64");                     \
+      }                                                                \
+    else                                                       \
+      {                                                                \
+       builtin_define ("_ABIO32=1");                           \
+       builtin_define ("_MIPS_SIM=_ABIO32");                   \
+        builtin_define ("_MIPS_SZLONG=32");                    \
+        builtin_define ("_MIPS_SZPTR=32");                     \
+      }                                                                \
+    if (TARGET_FLOAT64)                                                \
+      builtin_define ("_MIPS_FPSET=32");                       \
+    else                                                       \
+      builtin_define ("_MIPS_FPSET=16");                       \
+                                                               \
+    builtin_define ("_MIPS_SZINT=32");                         \
+  } while (0)
 
-/* We must make -mips3 do what -mlong64 used to do.  */
-/* ??? If no mipsX option given, but a mabi=X option is, then should set
-   _MIPS_ISA based on the mabi=X option.  */
-/* ??? If no mabi=X option give, but a mipsX option is, then should set
-   _MIPS_SIM based on the mipsX option.  */
-/* ??? Same for _MIPS_SZINT.  */
-/* ??? Same for _MIPS_SZPTR.  */
 #undef SUBTARGET_CPP_SPEC
-#define SUBTARGET_CPP_SPEC "\
-%{mfp32: -D_MIPS_FPSET=16} \
-%{mfp64: -D_MIPS_FPSET=32} \
-%{!mfp*: -D_MIPS_FPSET=32} \
-%{mips1: -D_MIPS_ISA=_MIPS_ISA_MIPS1} \
-%{mips2: -D_MIPS_ISA=_MIPS_ISA_MIPS2} \
-%{mips3: -D_MIPS_ISA=_MIPS_ISA_MIPS3} \
-%{mips4: -D_MIPS_ISA=_MIPS_ISA_MIPS4} \
-%{!mips*: -D_MIPS_ISA=_MIPS_ISA_MIPS1} \
-%{mabi=32: -D_MIPS_SIM=_MIPS_SIM_ABI32}        \
-%{mabi=n32: -D_ABIN32=2 -D_MIPS_SIM=_ABIN32} \
-%{mabi=64: -D_ABI64=3 -D_MIPS_SIM=_ABI64} \
-%{!mabi*: -D_MIPS_SIM=_MIPS_SIM_ABI32} \
-%{!mint64: -D_MIPS_SZINT=32}%{mint64: -D_MIPS_SZINT=64} \
-%{mabi=32: -D_MIPS_SZLONG=32} \
-%{mabi=n32: -D_MIPS_SZLONG=32} \
-%{mabi=64: -D_MIPS_SZLONG=64} \
-%{!mabi*: -D_MIPS_SZLONG=32} \
-%{mabi=32: -D_MIPS_SZPTR=32} \
-%{mabi=n32: -D_MIPS_SZPTR=32} \
-%{mabi=64: -D_MIPS_SZPTR=64} \
-%{!mabi*: -D_MIPS_SZPTR=32} \
-%{!mips*: -U__mips -D__mips} \
-%{mabi=32: -U__mips64} \
-%{mabi=n32: -D__mips64} \
-%{mabi=64: -U__mips64} \
-%{!mabi*: -U__mips64} \
-%{fno-PIC:-U__PIC__ -U__pic__} %{fno-pic:-U__PIC__ -U__pic__} \
-%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} \
-%{pthread:-D_REENTRANT}"
+#define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
 
-/* The GNU C++ standard library requires that these macros be defined.  */
-#undef CPLUSPLUS_CPP_SPEC
-#define CPLUSPLUS_CPP_SPEC "\
--D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS \
--D_GNU_SOURCE %(cpp) \
-"
+/* A standard GNU/Linux mapping.  On most targets, it is included in
+   CC1_SPEC itself by config/linux.h, but mips.h overrides CC1_SPEC
+   and provides this hook instead.  */
+#undef SUBTARGET_CC1_SPEC
+#define SUBTARGET_CC1_SPEC "%{profile:-p}"
 
 /* From iris5.h */
 /* -G is incompatible with -KPIC which is the default, so only allow objects
@@ -191,6 +104,8 @@ void FN ()                                                  \
 #undef MIPS_DEFAULT_GVALUE
 #define MIPS_DEFAULT_GVALUE 0
 
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+
 /* Borrowed from sparc/linux.h */
 #undef LINK_SPEC
 #define LINK_SPEC \
@@ -200,18 +115,11 @@ void FN ()                                                        \
     %{!ibcs: \
       %{!static: \
         %{rdynamic:-export-dynamic} \
-        %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
+        %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "}} \
         %{static:-static}}}"
 
-
 #undef SUBTARGET_ASM_SPEC
-#define SUBTARGET_ASM_SPEC "\
-%{mabi=64: -64} \
-%{!fno-PIC:%{!fno-pic:-KPIC}} \
-%{fno-PIC:-non_shared} %{fno-pic:-non_shared}"
-
-#undef SUBTARGET_ASM_DEBUGGING_SPEC
-#define SUBTARGET_ASM_DEBUGGING_SPEC "-g0"
+#define SUBTARGET_ASM_SPEC "%{mabi=64: -64} %{!mno-abicalls:-KPIC}"
 
 /* The MIPS assembler has different syntax for .set. We set it to
    .dummy to trap any errors.  */
@@ -228,17 +136,6 @@ void FN ()                                                 \
        fputc ( '\n', FILE);                                            \
  } while (0)
 
-#undef ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL
-#define ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL(FILE, SY, HI, LO)            \
-  do {                                                                 \
-       fputc ('\t', FILE);                                             \
-       assemble_name (FILE, SY);                                       \
-       fputc ('=', FILE);                                              \
-       assemble_name (FILE, HI);                                       \
-       fputc ('-', FILE);                                              \
-       assemble_name (FILE, LO);                                       \
-  } while (0)
-
 #undef ASM_DECLARE_FUNCTION_NAME
 #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL)                  \
   do {                                                                 \
@@ -248,11 +145,7 @@ void FN ()                                                 \
        assemble_name (STREAM, NAME);                                   \
        putc ('\n', STREAM);                                            \
       }                                                                        \
-    fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP);                          \
-    assemble_name (STREAM, NAME);                                      \
-    putc (',', STREAM);                                                        \
-    fprintf (STREAM, TYPE_OPERAND_FMT, "function");                    \
-    putc ('\n', STREAM);                                               \
+    ASM_OUTPUT_TYPE_DIRECTIVE (STREAM, NAME, "function");              \
     assemble_name (STREAM, NAME);                                      \
     fputs (":\n", STREAM);                                             \
   } while (0)
@@ -270,12 +163,8 @@ void FN ()                                                 \
 
 /* Tell function_prologue in mips.c that we have already output the .ent/.end
    pseudo-ops.  */
-#define FUNCTION_NAME_ALREADY_DECLARED
-
-#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL)                     \
-  (flag_pic                                                            \
-    ? ((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4\
-   : DW_EH_PE_absptr)
+#undef FUNCTION_NAME_ALREADY_DECLARED
+#define FUNCTION_NAME_ALREADY_DECLARED 1
 
 /* The glibc _mcount stub will save $v0 for us.  Don't mess with saving
    it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the
@@ -283,6 +172,19 @@ void FN ()                                                 \
 #undef ASM_OUTPUT_REG_PUSH
 #undef ASM_OUTPUT_REG_POP
 
-/* The current Linux binutils uses MIPS_STABS_ELF and doesn't support
-   COFF.  */
-#undef SDB_DEBUGGING_INFO
+#undef LIB_SPEC
+#define LIB_SPEC "\
+%{shared: -lc} \
+%{!shared: %{pthread:-lpthread} \
+  %{profile:-lc_p} %{!profile: -lc}}"
+
+#define MD_UNWIND_SUPPORT "config/mips/linux-unwind.h"
+
+#ifdef HAVE_AS_NO_SHARED
+/* Default to -mno-shared for non-PIC.  */
+#define NO_SHARED_SPECS \
+  "%{mshared|mno-shared|fpic|fPIC|fpie|fPIE:;:-mno-shared}"
+#define DRIVER_SELF_SPECS NO_SHARED_SPECS
+#else
+#define NO_SHARED_SPECS
+#endif