OSDN Git Service

* system.h (SELECT_RTX_SECTION): Poison.
[pf3gnuchains/gcc-fork.git] / gcc / config / mips / iris6.h
index c8d13c9..e1502a9 100644 (file)
@@ -1,5 +1,6 @@
 /* Definitions of target machine for GNU compiler.  Iris version 6.
-   Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002
+   Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -18,35 +19,180 @@ 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.  */
 
-/* Irix 6 uses DWARF.  */
-#define DWARF_DEBUGGING_INFO
-#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
+/* Let mips.c know we need the Irix6 functions.  */
+#define TARGET_IRIX6 1
 
-/* Default to -mips4.  */
-#define TARGET_DEFAULT MASK_ABICALLS|MASK_FLOAT64|MASK_64BIT
-#define MIPS_ISA_DEFAULT 4
-#define MULTILIB_DEFAULTS { "EB", "mips4" }
+/* Default to -mabi=n32 and -mips3.  */
+#define MIPS_ISA_DEFAULT 3
+#define MIPS_ABI_DEFAULT ABI_N32
+#define MULTILIB_DEFAULTS { "mabi=n32" }
 
-#include "mips/iris5gas.h"
+#ifndef TARGET_DEFAULT
+#define TARGET_DEFAULT (MASK_ABICALLS|MASK_FLOAT64|MASK_64BIT)
+#endif
+
+#include "mips/iris5.h"
 #include "mips/abi64.h"
 
-/* The Irix 6.0.1 assembler doesn't like labels in the text section, so
-   just avoid emitting them.  */
-#define ASM_IDENTIFY_GCC
-#define ASM_IDENTIFY_LANGUAGE
+/* Irix6 assembler does handle DWARF2 directives.  Override setting in
+   irix5.h file.  */
+#undef DWARF2_UNWIND_INFO
+
+/* The Irix6 assembler will sometimes assign labels to the wrong
+   section unless the labels are within .ent/.end blocks.  Therefore,
+   we avoid creating such labels.  */
+#define DWARF2_GENERATE_TEXT_SECTION_LABEL 0
+
+/* wchar_t is defined differently with and without -mabi=64.  */
+
+#undef WCHAR_TYPE
+#define WCHAR_TYPE (Pmode == DImode ? "int" : "long int")
+
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE 32
+
+/* Same for wint_t.  */
+
+#undef WINT_TYPE
+#define WINT_TYPE (Pmode == DImode ? "int" : "long int")
+
+#undef WINT_TYPE_SIZE
+#define WINT_TYPE_SIZE 32
+
+/* For Irix 6, -mabi=64 implies TARGET_LONG64.  */
+/* This is handled in override_options.  */
+
+#undef SUBTARGET_CC1_SPEC
+#define SUBTARGET_CC1_SPEC ""
+
+/* We must pass -D_LONGLONG always, even when -ansi is used, because irix6
+   system header files require it.  This is OK, because gcc never warns
+   when long long is used in system header files.  Alternatively, we can
+   add support for the SGI builtin type __long_long.  */
+#undef CPP_PREDEFINES
+#define CPP_PREDEFINES \
+ "-Dunix -Dmips -Dsgi -Dhost_mips -DMIPSEB -D_MIPSEB -DSYSTYPE_SVR4 \
+  -D_LONGLONG -D_SVR4_SOURCE -D_MODERN_C -D__DSO__ \
+  -Asystem=unix -Asystem=svr4 -Acpu=mips -Amachine=sgi"
+
+/* 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 "\
+%{!ansi:-D__EXTENSIONS__ -D_SGI_SOURCE} \
+%{mfp32: -D_MIPS_FPSET=16}%{!mfp32: -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_MIPS3} \
+%{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_ABIN32=2 -D_MIPS_SIM=_ABIN32} \
+%{!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} \
+%{!mips1:%{!mips2: -D_COMPILER_VERSION=601}}           \
+%{!mips*: -U__mips -D__mips=3} \
+%{mabi=32: -U__mips64} \
+%{mabi=n32: -D__mips64} \
+%{mabi=64: -D__mips64} \
+%{!mabi*: -D__mips64}"
+
+/* The GNU C++ standard library requires that __EXTENSIONS__ and
+   _SGI_SOURCE be defined on at least irix6.2 and probably all irix6
+   prior to 6.5.  They normally get defined in SUBTARGET_CPP_SPEC if
+   !ansi, for g++ we want them regardless.  We don't need this on
+   irix6.5 itself, but it shouldn't hurt other than the namespace
+   polution.  */
+#undef CPLUSPLUS_CPP_SPEC
+#define CPLUSPLUS_CPP_SPEC "\
+-D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS \
+%{ansi:-D__EXTENSIONS__ -D_SGI_SOURCE} %(cpp) \
+"
+
+/* Irix 6 uses DWARF-2.  */
+#define DWARF2_DEBUGGING_INFO
+#define MIPS_DEBUGGING_INFO
+#undef PREFERRED_DEBUGGING_TYPE
+#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
+
+/* Force the generation of dwarf .debug_frame sections even if not
+   compiling -g.  This guarantees that we can unwind the stack.  */
+#define DWARF2_FRAME_INFO 1
+
+/* The size in bytes of a DWARF field indicating an offset or length
+   relative to a debug info section, specified to be 4 bytes in the DWARF-2
+   specification.  The SGI/MIPS ABI defines it to be the same as PTR_SIZE.  */
+#define DWARF_OFFSET_SIZE PTR_SIZE
+
+/* There is no GNU as port for Irix6 yet, so we set MD_EXEC_PREFIX so that
+   gcc will automatically find SGI as instead of searching the user's path.
+   The latter can fail when building a cross compiler if the user has . in
+   the path before /usr/bin, since then gcc will find and try to use the link
+   to the cross assembler which can't possibly work.  */
+
+#undef MD_EXEC_PREFIX
+#define MD_EXEC_PREFIX "/usr/bin/"
+
+/* We have no need for MD_STARTFILE_PREFIX.  */
+#undef MD_STARTFILE_PREFIX
+
+#undef MACHINE_TYPE
+#define MACHINE_TYPE "SGI running IRIX 6.x"
 
 /* Irix 5 stuff that we don't need for Irix 6.  */
+/* ??? We do need this for the -mabi=32 switch though.  */
 #undef ASM_OUTPUT_UNDEF_FUNCTION
 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
 #undef ASM_DECLARE_FUNCTION_SIZE
 
 /* Stuff we need for Irix 6 that isn't in Irix 5.  */
 
+/* The SGI assembler doesn't like labels before the .ent, so we must output
+   the .ent and function name here, which is the normal place for it.  */
+
+#undef ASM_DECLARE_FUNCTION_NAME
+#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL)                  \
+  do {                                                                 \
+    fputs ("\t.ent\t", STREAM);                                                \
+    assemble_name (STREAM, NAME);                                      \
+    fputs ("\n", STREAM);                                              \
+    assemble_name (STREAM, NAME);                                      \
+    fputs (":\n", STREAM);                                             \
+  } while (0)
+
+/* Likewise, the SGI assembler doesn't like labels after the .end, so we
+   must output the .end here.  */
+#define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL)                  \
+  do {                                                                 \
+    fputs ("\t.end\t", STREAM);                                                \
+    assemble_name (STREAM, NAME);                                      \
+    fputs ("\n", STREAM);                                              \
+  } while (0)
+
+/* Tell function_prologue in mips.c that we have already output the .ent/.end
+   pseudo-ops.  */
+#define FUNCTION_NAME_ALREADY_DECLARED
+
 #undef SET_ASM_OP      /* Has no equivalent.  See ASM_OUTPUT_DEF below.  */
 
-/* This is how to equate one symbol to another symbol.  The syntax used is
-   `SYM1=SYM2'.  Note that this is different from the way equates are done
-   with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'.  */
+#if 0
+/* This is *NOT* how to equate one symbol to another symbol.  The assembler
+   '=' syntax just equates a name to a constant expression.
+   See ASM_OUTPUT_WEAK_ALIAS.  */
 
 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                             \
  do {  fprintf ((FILE), "\t");                                         \
@@ -55,73 +201,63 @@ Boston, MA 02111-1307, USA.  */
        assemble_name (FILE, LABEL2);                                   \
        fprintf (FILE, "\n");                                           \
   } while (0)
+#endif
+
+/* Define the strings used for the special svr4 .type and .size directives.  */
+
+#define TYPE_ASM_OP    "\t.type\t"
+#define SIZE_ASM_OP    "\t.size\t"
+
+/* Irix assembler does not support the init_priority C++ attribute.  */
+#undef SUPPORTS_INIT_PRIORITY
+#define SUPPORTS_INIT_PRIORITY 0
+
+/* A linker error can empirically be avoided by removing duplicate
+   library search directories.  */
+#define LINK_ELIMINATE_DUPLICATE_LDIRECTORIES 1
+
+#define POPSECTION_ASM_OP      "\t.popsection"
+
+/* ??? If no mabi=X option give, but a mipsX option is, then should depend
+   on the mipsX option.  */
+/* If no mips[3,4] option given, give the appropriate default for mabi=X */
+#undef SUBTARGET_ASM_SPEC
+#define SUBTARGET_ASM_SPEC "%{!mabi*:-n32} %{!mips*: %{!mabi*:-mips3} %{mabi=n32:-mips3} %{mabi=64:-mips4}}"
 
-#define POPSECTION_ASM_OP      ".popsection"
-
-#define DEBUG_SECTION          ".debug,1,0,0,1"
-#define LINE_SECTION           ".line,1,0,0,1"
-#define SFNAMES_SECTION                ".debug_sfnames,1,0,0,1"
-#define SRCINFO_SECTION                ".debug_srcinfo,1,0,0,1"
-#define MACINFO_SECTION                ".debug_macinfo,1,0,0,1"
-#define PUBNAMES_SECTION       ".debug_pubnames,1,0,0,1"
-#define ARANGES_SECTION                ".debug_aranges,1,0,0,1"
-
-#undef ASM_SPEC
-#if ((TARGET_CPU_DEFAULT | TARGET_DEFAULT) & MASK_GAS) != 0
-/* GAS */
-#define ASM_SPEC "\
-%{mmips-as: \
-       %{!.s:-nocpp} %{.s: %{cpp} %{nocpp}} \
-       %{pipe: %e-pipe is not supported.} \
-       %{K}} \
-%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} %{v} \
-%{noasmopt:-O0} \
-%{!noasmopt:%{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3}} \
-%{g} %{g0} %{g1} %{g2} %{g3} \
-%{ggdb:-g} %{ggdb0:-g0} %{ggdb1:-g1} %{ggdb2:-g2} %{ggdb3:-g3} \
-%{gstabs:-g} %{gstabs0:-g0} %{gstabs1:-g1} %{gstabs2:-g2} %{gstabs3:-g3} \
-%{gstabs+:-g} %{gstabs+0:-g0} %{gstabs+1:-g1} %{gstabs+2:-g2} %{gstabs+3:-g3} \
-%{gcoff:-g} %{gcoff0:-g0} %{gcoff1:-g1} %{gcoff2:-g2} %{gcoff3:-g3} \
-%{membedded-pic}"
-
-#else
-/* not GAS */
 /* Must pass -g0 to the assembler, otherwise it may overwrite our
-   debug info with its own debug info. */
+   debug info with its own debug info.  */
 /* Must pass -show instead of -v.  */
 /* Must pass -G 0 to the assembler, otherwise we may get warnings about
    GOT overflow.  */
-#define ASM_SPEC "\
-%{!mgas: \
-       %{!.s:-nocpp} %{.s: %{cpp} %{nocpp}} \
-       %{pipe: %e-pipe is not supported.} \
-       %{K}} \
-%{G*} %{EB} %{EL} %{v:-show} \
-%{mips1} %{mips2} %{mips3} %{mips4} \
-%{!mips1: %{!mips2: %{!mips3: %{!mips4: -mips4}}}} \
-%{noasmopt:-O0} %{!noasmopt:%{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3}} \
--g0 -G 0 %{membedded-pic}"
+/* ??? We pass -w to disable all assembler warnings.  The `label should be
+   inside .ent/.end block' warning that we get for DWARF II debug info labels
+   is particularly annoying.  */
+#undef SUBTARGET_MIPS_AS_ASM_SPEC
+#define SUBTARGET_MIPS_AS_ASM_SPEC "%{v:-show} -G 0 -w"
 
-#endif
+#undef SUBTARGET_ASM_DEBUGGING_SPEC
+#define SUBTARGET_ASM_DEBUGGING_SPEC "-g0"
 
-/* Stuff for constructors.  Start here.  */
+/* The MIPS assembler occasionally misoptimizes.  Since GCC should be
+   doing scheduling anyhow, just turn off optimization in the assembler.  */
+#undef SUBTARGET_ASM_OPTIMIZING_SPEC
+#define SUBTARGET_ASM_OPTIMIZING_SPEC "-O0"
 
 /* The assembler now accepts .section pseudo-ops, but it does not allow
-   one to change the section in the middle of a function.  crtstuff relies
-   on this hack, and thus crtstuff won't work here.  So, we do init and
-   fini sections exactly the same way as they are done for Irix 5, and
-   we ifdef out the ASM_OUTPUT_{CON,DE}STRUCTOR macros below.  */
-
-#define CONST_SECTION_ASM_OP_32        "\t.rdata"
-#define CONST_SECTION_ASM_OP_64        ".section\t.rodata"
-#define CTORS_SECTION_ASM_OP   ".section\t.ctors,1,2,0,4"
-#define DTORS_SECTION_ASM_OP   ".section\t.dtors,1,2,0,4"
+   one to change the section in the middle of a function, so we can't use
+   the INIT_SECTION_ASM_OP code in crtstuff.  But we can build up the ctor
+   and dtor lists this way, so we use -init and -fini to invoke the
+   do_global_* functions instead of running collect2.  */
 
-/* This is the pseudo-op used to generate a 32-bit word of data with a
-   specific value in some section.  This is the same for all known svr4
-   assemblers.  */
+#define BSS_SECTION_ASM_OP     "\t.section\t.bss"
 
-#define INT_ASM_OP             ".word"
+#undef READONLY_DATA_SECTION_ASM_OP
+#define READONLY_DATA_SECTION_ASM_OP_32        "\t.rdata"
+#define READONLY_DATA_SECTION_ASM_OP_64        "\t.section\t.rodata"
+#define READONLY_DATA_SECTION_ASM_OP           \
+  (mips_abi != ABI_32 && mips_abi != ABI_O64   \
+   ? READONLY_DATA_SECTION_ASM_OP_64           \
+   : READONLY_DATA_SECTION_ASM_OP_32)
 
 /* A default list of other sections which we might be "in" at any given
    time.  For targets that use additional sections (e.g. .tdesc) you
@@ -129,14 +265,12 @@ Boston, MA 02111-1307, USA.  */
    includes this file.  */
 
 #undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_sdata, in_rdata, in_const, in_ctors, in_dtors
+#define EXTRA_SECTIONS in_sdata
 
 /* A default list of extra section function definitions.  For targets
    that use additional sections (e.g. .tdesc) you should override this
    definition in the target-specific file which includes this file.  */
 
-/* ??? rdata_section is now same as svr4 const_section.  */
-
 #undef EXTRA_SECTION_FUNCTIONS
 #define EXTRA_SECTION_FUNCTIONS                                                \
 void                                                                   \
@@ -149,70 +283,57 @@ sdata_section ()                                                  \
     }                                                                  \
 }                                                                      \
                                                                        \
-void                                                                   \
-rdata_section ()                                                       \
+const char *                                                           \
+current_section_name ()                                                        \
 {                                                                      \
-  if (in_section != in_rdata)                                          \
+  switch (in_section)                                                  \
     {                                                                  \
-      if (mips_isa >= 3)                                               \
-       fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP_64);        \
+    case no_section:   return NULL;                                    \
+    case in_text:      return ".text";                                 \
+    case in_data:      return ".data";                                 \
+    case in_sdata:     return ".sdata";                                \
+    case in_bss:       return ".bss";                                  \
+    case in_readonly_data:                                             \
+      if (mips_abi != ABI_32 && mips_abi != ABI_O64)                   \
+       return ".rodata";                                               \
       else                                                             \
-       fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP_32);        \
-      in_section = in_rdata;                                           \
+       return ".rdata";                                                \
+    case in_named:                                                     \
+      return in_named_name;                                            \
     }                                                                  \
+  abort ();                                                            \
 }                                                                      \
-  CTORS_SECTION_FUNCTION                                               \
-  DTORS_SECTION_FUNCTION
-
-#define CTORS_SECTION_FUNCTION                                         \
-void                                                                   \
-ctors_section ()                                                       \
-{                                                                      \
-  if (in_section != in_ctors)                                          \
-    {                                                                  \
-      fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP);            \
-      in_section = in_ctors;                                           \
-    }                                                                  \
-}
-
-#define DTORS_SECTION_FUNCTION                                         \
-void                                                                   \
-dtors_section ()                                                       \
+                                                                       \
+unsigned int                                                           \
+current_section_flags ()                                               \
 {                                                                      \
-  if (in_section != in_dtors)                                          \
+  switch (in_section)                                                  \
     {                                                                  \
-      fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP);            \
-      in_section = in_dtors;                                           \
+    case no_section:   return 0;                                       \
+    case in_text:      return SECTION_CODE;                            \
+    case in_data:      return SECTION_WRITE;                           \
+    case in_sdata:     return SECTION_WRITE | SECTION_SMALL;           \
+    case in_bss:       return SECTION_WRITE | SECTION_BSS;             \
+    case in_readonly_data: return 0;                                   \
+    case in_named:     return get_named_section_flags (in_named_name); \
     }                                                                  \
+  abort ();                                                            \
 }
 
-#if 0
-
-/* A C statement (sans semicolon) to output an element in the table of
-   global constructors.  */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)                              \
-  do {                                                                 \
-    ctors_section ();                                                  \
-    fprintf (FILE, "\t%s\t ", INT_ASM_OP);                             \
-    assemble_name (FILE, NAME);                                                \
-    fprintf (FILE, "\n");                                              \
-  } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
-   global destructors.  */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)                                       \
-  do {                                                                 \
-    dtors_section ();                                                  \
-    fprintf (FILE, "\t%s\t ", INT_ASM_OP);                             \
-    assemble_name (FILE, NAME);                                        \
-    fprintf (FILE, "\n");                                              \
-  } while (0)
+/* Switch into a generic section.  */
+#undef TARGET_ASM_NAMED_SECTION
+#define TARGET_ASM_NAMED_SECTION  iris6_asm_named_section
 
-#endif
+/* SGI assembler needs all sorts of extra help to do alignment properly.  */
+#undef ASM_OUTPUT_ALIGN
+#define ASM_OUTPUT_ALIGN iris6_asm_output_align
+#undef ASM_FILE_START
+#define ASM_FILE_START  iris6_asm_file_start
+#undef ASM_FILE_END
+#define ASM_FILE_END   iris6_asm_file_end
 
-/* Stuff for constructors.  End here.  */
-
-/* ??? Perhaps just include svr4.h in this file?  */
+#undef MAX_OFILE_ALIGNMENT
+#define MAX_OFILE_ALIGNMENT (32768*8)
 
 /* ??? SGI assembler may core dump when compiling with -g.
    Sometimes as succeeds, but then we get a linker error. (cmds.c in 072.sc)
@@ -229,63 +350,151 @@ while (0)
 
 /* ??? SGI assembler gives warning whenever .lcomm is used.  */
 #undef ASM_OUTPUT_LOCAL
-#define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN)    \
-do                                                             \
-  {                                                            \
-    if (mips_isa >= 3)                                         \
-      {                                                                \
-       fputs ("\t.section\t.bss\n", STREAM);                   \
-       ASM_DECLARE_OBJECT_NAME (STREAM, NAME, 0);              \
-       ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT));  \
-       ASM_OUTPUT_SKIP (STREAM, SIZE);                         \
-       fprintf (STREAM, "\t%s\n", POPSECTION_ASM_OP);          \
-      }                                                                \
-    else                                                       \
+#define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN)               \
+do                                                                        \
+  {                                                                       \
+    if (mips_abi != ABI_32 && mips_abi != ABI_O64)                        \
+      {                                                                           \
+       bss_section ();                                                    \
+       mips_declare_object (STREAM, NAME, "", ":\n", 0);                  \
+       ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT));     \
+       ASM_OUTPUT_SKIP (STREAM, SIZE);                                    \
+      }                                                                           \
+    else                                                                  \
       mips_declare_object (STREAM, NAME, "\n\t.lcomm\t", ",%u\n", (SIZE)); \
-  }                                                            \
+  }                                                                       \
 while (0)
 
-#undef ASM_OUTPUT_INTERNAL_LABEL
-#define ASM_OUTPUT_INTERNAL_LABEL(STREAM,PREFIX,NUM)                   \
-  fprintf (STREAM, ".%s%d:\n", 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.
-   This is suitable for output with `assemble_name'.  */
+/* A C statement (sans semicolon) to output to the stdio stream
+   FILE the assembler definition of uninitialized global DECL named
+   NAME whose size is SIZE bytes and alignment is ALIGN bytes.
+   Try to use asm_output_aligned_bss to implement this macro.  */
+
+#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
+  asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
+
+/* Write the extra assembler code needed to declare an object properly.  */
+
+#undef ASM_DECLARE_OBJECT_NAME
+#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL)                    \
+do                                                                     \
+ {                                                                     \
+   size_directive_output = 0;                                          \
+   if (!flag_inhibit_size_directive && DECL_SIZE (DECL))       \
+     {                                                                 \
+       size_directive_output = 1;                                      \
+       fprintf (STREAM, "%s", SIZE_ASM_OP);                            \
+       assemble_name (STREAM, NAME);                                   \
+       fprintf (STREAM, ",");                                          \
+       fprintf (STREAM, HOST_WIDE_INT_PRINT_DEC, int_size_in_bytes (TREE_TYPE (DECL)));        \
+       fprintf (STREAM, "\n");                                         \
+     }                                                                 \
+   mips_declare_object (STREAM, NAME, "", ":\n", 0);                   \
+ }                                                                     \
+while (0)
 
-#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)                  \
-  sprintf (LABEL, "*.%s%d", PREFIX, NUM)
+/* Define the `__builtin_va_list' type for the ABI.  On Irix6, this
+   type is `char *'.  */
+#undef BUILD_VA_LIST_TYPE
+#define BUILD_VA_LIST_TYPE(VALIST) \
+  (VALIST) = build_pointer_type (char_type_node)
+
+/* Output the size directive for a decl in rest_of_decl_compilation
+   in the case where we did not do so before the initializer.
+   Once we find the error_mark_node, we know that the value of
+   size_directive_output was set
+   by ASM_DECLARE_OBJECT_NAME when it was run for the same decl.  */
+
+#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)        \
+do {                                                                    \
+     const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);            \
+     if (!flag_inhibit_size_directive && DECL_SIZE (DECL)               \
+         && ! AT_END && TOP_LEVEL                                       \
+        && DECL_INITIAL (DECL) == error_mark_node                       \
+        && !size_directive_output)                                      \
+       {                                                                \
+        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");                                           \
+       }                                                                \
+   } while (0)
+
+#undef LOCAL_LABEL_PREFIX
+#define LOCAL_LABEL_PREFIX ((mips_abi == ABI_32 || mips_abi == ABI_O64) \
+                           ? "$" : ".")
 
-#undef STARTFILE_SPEC
 /* Profiling is supported via libprof1.a not -lc_p as in Irix 3.  */
+/* ??? If no mabi=X option give, but a mipsX option is, then should depend
+   on the mipsX option.  */
 #undef STARTFILE_SPEC
 #define STARTFILE_SPEC \
-  "%{mips1:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}} \
-   %{mips2:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}} \
-   %{!mips1:%{!mips2:%{pg:/usr/lib64/gcrt1.o}%{!pg:%{p:/usr/lib64/mcrt1.o /usr/lib64/libprof1.a}%{!p:/usr/lib64/crt1.o}}}}"
+  "%{!shared: \
+     %{mabi=32:%{pg:gcrt1.o%s} \
+       %{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}} \
+     %{mabi=n32: \
+       %{mips4:%{pg:/usr/lib32/mips4/gcrt1.o%s} \
+         %{!pg:%{p:/usr/lib32/mips4/mcrt1.o%s /usr/lib32/mips4/libprof1.a%s} \
+           %{!p:/usr/lib32/mips4/crt1.o%s}}} \
+       %{!mips4:%{pg:/usr/lib32/mips3/gcrt1.o%s} \
+         %{!pg:%{p:/usr/lib32/mips3/mcrt1.o%s /usr/lib32/mips3/libprof1.a%s} \
+           %{!p:/usr/lib32/mips3/crt1.o%s}}}} \
+     %{mabi=64: \
+       %{mips4:%{pg:/usr/lib64/mips4/gcrt1.o} \
+         %{!pg:%{p:/usr/lib64/mips4/mcrt1.o /usr/lib64/mips4/libprof1.a} \
+           %{!p:/usr/lib64/mips4/crt1.o}}} \
+       %{!mips4:%{pg:/usr/lib64/mips3/gcrt1.o} \
+         %{!pg:%{p:/usr/lib64/mips3/mcrt1.o /usr/lib64/mips3/libprof1.a} \
+           %{!p:/usr/lib64/mips3/crt1.o}}}} \
+     %{!mabi*: \
+       %{mips4:%{pg:/usr/lib32/mips4/gcrt1.o%s} \
+         %{!pg:%{p:/usr/lib32/mips4/mcrt1.o%s /usr/lib32/mips4/libprof1.a%s} \
+           %{!p:/usr/lib32/mips4/crt1.o%s}}} \
+       %{!mips4:%{pg:/usr/lib32/mips3/gcrt1.o%s} \
+         %{!pg:%{p:/usr/lib32/mips3/mcrt1.o%s /usr/lib32/mips3/libprof1.a%s} \
+           %{!p:/usr/lib32/mips3/crt1.o%s}}}}} \
+   crtbegin.o%s"
 
 #undef LIB_SPEC
-#define LIB_SPEC "%{p:libprof1.a%s}%{pg:libprof1.a%s} -lc"
-
+#define LIB_SPEC \
+  "%{mabi=n32: %{mips4:-L/usr/lib32/mips4} %{!mips4:-L/usr/lib32/mips3} \
+     -L/usr/lib32} \
+   %{mabi=64: %{mips4:-L/usr/lib64/mips4} %{!mips4:-L/usr/lib64/mips3} \
+     -L/usr/lib64} \
+   %{!mabi*: %{mips4:-L/usr/lib32/mips4} %{!mips4:-L/usr/lib32/mips3} \
+     -L/usr/lib32} \
+   %{!shared: \
+     -dont_warn_unused %{p:libprof1.a%s}%{pg:libprof1.a%s} -lc -warn_unused}"
+
+/* Avoid getting two warnings for libgcc.a everytime we link.  */
+#undef LIBGCC_SPEC
+#define LIBGCC_SPEC "-dont_warn_unused -lgcc -warn_unused"
+
+/* ??? If no mabi=X option give, but a mipsX option is, then should depend
+   on the mipsX option.  */
 #undef ENDFILE_SPEC
 #define ENDFILE_SPEC \
-  "%{mips1:crtn.o%s}%{mips2:crtn.o%s}%{!mips1:%{!mips2:/usr/lib64/crtn.o}}"
-
+  "crtend.o%s \
+   %{!shared: \
+     %{mabi=32:crtn.o%s}\
+     %{mabi=n32:%{mips4:/usr/lib32/mips4/crtn.o%s}\
+       %{!mips4:/usr/lib32/mips3/crtn.o%s}}\
+     %{mabi=64:%{mips4:/usr/lib64/mips4/crtn.o%s}\
+       %{!mips4:/usr/lib64/mips3/crtn.o%s}}\
+     %{!mabi*:%{mips4:/usr/lib32/mips4/crtn.o%s}\
+       %{!mips4:/usr/lib32/mips3/crtn.o%s}}}"
+
+/* ??? If no mabi=X option give, but a mipsX option is, then should depend
+   on the mipsX option.  */
 #undef LINK_SPEC
 #define LINK_SPEC "\
 %{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
 %{bestGnum} %{shared} %{non_shared} \
-%{call_shared} %{no_archive} %{exact_version} \
+%{call_shared} %{no_archive} %{exact_version} %{w} \
 %{!shared: %{!non_shared: %{!call_shared: -call_shared -no_unresolved}}} \
-%{rpath} \
--_SYSTYPE_SVR4"
-
-/* ??? Debugging does not work.  We get many assembler core dumps,
-   and even some linker core dumps.  */
-#undef DBX_DEBUGGING_INFO
-#undef SDB_DEBUGGING_INFO
-#undef MIPS_DEBUGGING_INFO
-#undef DWARF_DEBUGGING_INFO
-#undef PREFERRED_DEBUGGING_TYPE
+%{rpath} -init __do_global_ctors -fini __do_global_dtors \
+%{shared:-hidden_symbol __do_global_ctors,__do_global_ctors_1,__do_global_dtors} \
+-_SYSTYPE_SVR4 -woff 131 \
+%{mabi=32: -32}%{mabi=n32: -n32}%{mabi=64: -64}%{!mabi*: -n32}"