OSDN Git Service

* config.gcc (mips-sgi-irix6*o32): Only enable use_collect2
authorro <ro@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 17 Oct 2003 11:44:33 +0000 (11:44 +0000)
committerro <ro@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 17 Oct 2003 11:44:33 +0000 (11:44 +0000)
without gas.
(mips-sgi-irix6*): Likewise.

* config/mips/iris6gas.h: New file.
* gcc/config.gcc (mips-sgi-irix6*): Use it.

* config/mips/mips.h (TARGET_IRIX): Provide default.
(TARGET_IRIX5): Likewise.
(TARGET_SGI_O32_AS): Likewise.
* config/mips/iris5.h (TARGET_IRIX): Redefine as 1.
(TARGET_IRIX5): Likewise.
* config/mips/iris6.h (TARGET_IRIX6): Remove.
(TARGET_IRIX5): Redefine as 0.

* config/mips/mips.c (mips_output_external): Test for IRIX 6 O32
linker workaround with TARGET_IRIX and mips_abi instead of
ASM_OUTPUT_UNDEF_FUNCTION.
(mips_file_end): Inline old ASM_OUTPUT_UNDEF_FUNCTION definition,
testing TARGET_IRIX and mips_abi explicitly.
* config/mips/iris5.h (ASM_OUTPUT_UNDEF_FUNCTION): Remove.
* config/mips/iris6.h (ASM_OUTPUT_UNDEF_FUNCTION): Remove undef.

* config/mips/mips.c (irix_output_external_libcall): Renamed from
mips_output_external_libcall.
Use new TARGET_IRIX in guard.
* config/mips/mips-protos.h (irix_output_external_libcall): Match
this.
* config/mips/iris5.h (TARGET_ASM_EXTERNAL_LIBCALL): Likewise.

* config/mips/iris5gas.h (HAVE_GAS_SHF_MERGE): Update comment.
Define as 0.

* config/mips/iris6.h (FUNCTION_NAME_ALREADY_DECLARED): Define
depending on mips_abi.
* config/mips/linux.h (FUNCTION_NAME_ALREADY_DECLARED): Define as 1.
* config/mips/mips.c (mips_output_function_prologue): Test
FUNCTION_NAME_ALREADY_DECLARED at runtime.
(mips_output_function_epilogue): Likewise.
(build_mips16_function_stub): Likewise.
(build_mips16_call_stub): Likewise.
* config/mips/mips.h (FUNCTION_NAME_ALREADY_DECLARED): Provide
default.

* config/mips/iris6.h (DWARF2_UNWIND_INFO): Don't define for native
IRIX 6 O32 assembler.
(SUBTARGET_CC1_SPEC): Enforce mips2 ISA with O32 ABI.
(TARGET_OS_CPP_BUILTINS): Define _ABIO32, use it to define
_MIPS_SIM for O32 ABI.
(DWARF2_FRAME_INFO): Don't define for native IRIX 6 O32 assembler.
(ASM_DECLARE_FUNCTION_NAME): Integrate mips.h version.
(ASM_DECLARE_FUNCTION_SIZE): Move undef before redefinition.
Integrate O32 version.
(SUBTARGET_ASM_SPEC): Handle -mabi=32.
(SUBTARGET_ASM_DEBUGGING_SPEC): Add mdebug_asm_spec for gas with
O32 ABI.
(BSS_SECTION_ASM_OP_32): Define.
(BSS_SECTION_ASM_OP_64): Likewise.
(BSS_SECTION_ASM_OP): Define differently for O32 and N32/N64 ABIs
using them.
(TARGET_ASM_NAMED_SECTION): Reflect renaming.
Move up to allow override for O32 ABI without GNU as.
(EH_FRAME_SECTION_NAME): Define explicitly.
(MUST_USE_SJLJ_EXCEPTIONS): Define.
[_MIPS_SIM == _ABIO32 && !GAS] (CTORS_SECTION_ASM_OP,
DTORS_SECTION_ASM_OP): Dummy definitions.
(TARGET_ASM_NAMED_SECTION): Undef statically.
(EH_FRAME_SECTION_NAME): Likewise.
(ASM_OUTPUT_FILENAME): Integrate mips.h version.
(LINK_SPEC): Only use default options -call_shared -no_unresolved
without -r.
Don't pass -init, -fini with -mabi=32.
(COLLECT_PARSE_FLAG): Define.

* config/mips/mips.c (iris6_asm_named_section_1): Changed guard to
TARGET_IRIX.
Renamed to use irix_ prefix.
(iris6_asm_named_section): Likewise.
(iris_section_align_entry_eq): Likewise.
(iris_section_align_entry_hash): Likewise.
(iris6_file_start): Likewise.
(iris6_section_align_1): Likewise.
(iris6_file_end): Likewise.
(iris6_section_type_flags): Likewise.
(iris_section_align_htab): Likewise.
(iris_orig_asm_out_file): Likewise.
[TARGET_IRIX] (TARGET_ASM_FILE_START): Reflect rename.
(TARGET_ASM_FILE_END): Likewise.
(TARGET_SECTION_TYPE_FLAGS): Likewise.

* config/mips/mips.c [TARGET_IRIX5 && !TARGET_IRIX6]
(TARGET_ASM_UNALIGNED_HI_OP): Use runtime initialization in
override_options instead.
(TARGET_ASM_UNALIGNED_SI_OP): Likewise.
(TARGET_ASM_UNALIGNED_DI_OP): Likewise.
* config/mips/mips.c (override_options) [USE_COLLECT2]: Restore
flag_gnu_linker to defaults without USE_COLLECT2 for non-IRIX O32
assemblers.
Likewise for constructor/destructor handling.
(override_options): Handle IRIX O32 assembler quirks.
[TARGET_IRIX] (irix_asm_named_section): Handle O32 ABI with and
without gas.
(mips_file_start): Use new TARGET_IRIX.
(mips_declare_object_name): No special processing for IRIX O32
assembler.
(mips_finish_declare_object): Likewise.
(irix_asm_output_align): Renamed from iris6_asm_output_align.
Don't record alignment for O32 ABI.
(irix_file_start): Renamed from iris6_file_start.
Return early for O32 ABI.
(irix_file_end): Renamed from iris6_file_end.
Don't emit .section directives for O32 ABI.
* config/mips/iris6.h (ASM_OUTPUT_ALIGN): Reflect renaming.
* config/mips/mips-protos.h (irix_asm_output_align): Likewise.

* config/mips/t-iris6 (MULTILIB_OPTIONS): Add mabi=32.
(MULTILIB_OSDIRNAMES): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72600 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config.gcc
gcc/config/mips/iris5.h
gcc/config/mips/iris5gas.h
gcc/config/mips/iris6.h
gcc/config/mips/iris6gas.h [new file with mode: 0644]
gcc/config/mips/linux.h
gcc/config/mips/mips-protos.h
gcc/config/mips/mips.c
gcc/config/mips/mips.h
gcc/config/mips/t-iris6

index 0154838..b73afb9 100644 (file)
@@ -1,5 +1,125 @@
 2003-10-17  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
 
+       * config.gcc (mips-sgi-irix6*o32): Only enable use_collect2
+       without gas.
+       (mips-sgi-irix6*): Likewise.
+
+       * config/mips/iris6gas.h: New file.
+       * gcc/config.gcc (mips-sgi-irix6*): Use it.
+
+       * config/mips/mips.h (TARGET_IRIX): Provide default.
+       (TARGET_IRIX5): Likewise.
+       (TARGET_SGI_O32_AS): Likewise.
+       * config/mips/iris5.h (TARGET_IRIX): Redefine as 1.
+       (TARGET_IRIX5): Likewise.
+       * config/mips/iris6.h (TARGET_IRIX6): Remove.
+       (TARGET_IRIX5): Redefine as 0.
+
+       * config/mips/mips.c (mips_output_external): Test for IRIX 6 O32
+       linker workaround with TARGET_IRIX and mips_abi instead of
+       ASM_OUTPUT_UNDEF_FUNCTION.
+       (mips_file_end): Inline old ASM_OUTPUT_UNDEF_FUNCTION definition,
+       testing TARGET_IRIX and mips_abi explicitly.
+       * config/mips/iris5.h (ASM_OUTPUT_UNDEF_FUNCTION): Remove.
+       * config/mips/iris6.h (ASM_OUTPUT_UNDEF_FUNCTION): Remove undef.
+
+       * config/mips/mips.c (irix_output_external_libcall): Renamed from
+       mips_output_external_libcall.
+       Use new TARGET_IRIX in guard.
+       * config/mips/mips-protos.h (irix_output_external_libcall): Match
+       this.
+       * config/mips/iris5.h (TARGET_ASM_EXTERNAL_LIBCALL): Likewise.
+
+       * config/mips/iris5gas.h (HAVE_GAS_SHF_MERGE): Update comment.
+       Define as 0.
+
+       * config/mips/iris6.h (FUNCTION_NAME_ALREADY_DECLARED): Define
+       depending on mips_abi. 
+       * config/mips/linux.h (FUNCTION_NAME_ALREADY_DECLARED): Define as 1.
+       * config/mips/mips.c (mips_output_function_prologue): Test
+       FUNCTION_NAME_ALREADY_DECLARED at runtime.
+       (mips_output_function_epilogue): Likewise.
+       (build_mips16_function_stub): Likewise.
+       (build_mips16_call_stub): Likewise.
+       * config/mips/mips.h (FUNCTION_NAME_ALREADY_DECLARED): Provide
+       default.
+       
+       * config/mips/iris6.h (DWARF2_UNWIND_INFO): Don't define for native
+       IRIX 6 O32 assembler.
+       (SUBTARGET_CC1_SPEC): Enforce mips2 ISA with O32 ABI.
+       (TARGET_OS_CPP_BUILTINS): Define _ABIO32, use it to define
+       _MIPS_SIM for O32 ABI.
+       (DWARF2_FRAME_INFO): Don't define for native IRIX 6 O32 assembler.
+       (ASM_DECLARE_FUNCTION_NAME): Integrate mips.h version.
+       (ASM_DECLARE_FUNCTION_SIZE): Move undef before redefinition.
+       Integrate O32 version.
+       (SUBTARGET_ASM_SPEC): Handle -mabi=32.
+       (SUBTARGET_ASM_DEBUGGING_SPEC): Add mdebug_asm_spec for gas with
+       O32 ABI.
+       (BSS_SECTION_ASM_OP_32): Define.
+       (BSS_SECTION_ASM_OP_64): Likewise.
+       (BSS_SECTION_ASM_OP): Define differently for O32 and N32/N64 ABIs
+       using them.
+       (TARGET_ASM_NAMED_SECTION): Reflect renaming.
+       Move up to allow override for O32 ABI without GNU as.
+       (EH_FRAME_SECTION_NAME): Define explicitly.
+       (MUST_USE_SJLJ_EXCEPTIONS): Define.
+       [_MIPS_SIM == _ABIO32 && !GAS] (CTORS_SECTION_ASM_OP,
+       DTORS_SECTION_ASM_OP): Dummy definitions.
+       (TARGET_ASM_NAMED_SECTION): Undef statically. 
+       (EH_FRAME_SECTION_NAME): Likewise.
+       (ASM_OUTPUT_FILENAME): Integrate mips.h version.
+       (LINK_SPEC): Only use default options -call_shared -no_unresolved
+       without -r.
+       Don't pass -init, -fini with -mabi=32.
+       (COLLECT_PARSE_FLAG): Define.
+
+       * config/mips/mips.c (iris6_asm_named_section_1): Changed guard to
+       TARGET_IRIX.
+       Renamed to use irix_ prefix.
+       (iris6_asm_named_section): Likewise.
+       (iris_section_align_entry_eq): Likewise.
+       (iris_section_align_entry_hash): Likewise.
+       (iris6_file_start): Likewise.
+       (iris6_section_align_1): Likewise.
+       (iris6_file_end): Likewise.
+       (iris6_section_type_flags): Likewise.
+       (iris_section_align_htab): Likewise.
+       (iris_orig_asm_out_file): Likewise.
+       [TARGET_IRIX] (TARGET_ASM_FILE_START): Reflect rename.
+       (TARGET_ASM_FILE_END): Likewise.
+       (TARGET_SECTION_TYPE_FLAGS): Likewise.
+
+       * config/mips/mips.c [TARGET_IRIX5 && !TARGET_IRIX6]
+       (TARGET_ASM_UNALIGNED_HI_OP): Use runtime initialization in
+       override_options instead.
+       (TARGET_ASM_UNALIGNED_SI_OP): Likewise.
+       (TARGET_ASM_UNALIGNED_DI_OP): Likewise.
+       * config/mips/mips.c (override_options) [USE_COLLECT2]: Restore
+       flag_gnu_linker to defaults without USE_COLLECT2 for non-IRIX O32
+       assemblers.
+       Likewise for constructor/destructor handling.
+       (override_options): Handle IRIX O32 assembler quirks.
+       [TARGET_IRIX] (irix_asm_named_section): Handle O32 ABI with and
+       without gas.
+       (mips_file_start): Use new TARGET_IRIX.
+       (mips_declare_object_name): No special processing for IRIX O32
+       assembler.
+       (mips_finish_declare_object): Likewise.
+       (irix_asm_output_align): Renamed from iris6_asm_output_align.
+       Don't record alignment for O32 ABI.
+       (irix_file_start): Renamed from iris6_file_start.
+       Return early for O32 ABI.
+       (irix_file_end): Renamed from iris6_file_end.
+       Don't emit .section directives for O32 ABI.
+       * config/mips/iris6.h (ASM_OUTPUT_ALIGN): Reflect renaming.
+       * config/mips/mips-protos.h (irix_asm_output_align): Likewise.
+
+       * config/mips/t-iris6 (MULTILIB_OPTIONS): Add mabi=32.
+       (MULTILIB_OSDIRNAMES): Likewise.
+
+2003-10-17  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
        * collect2.c (COLLECT_PARSE_FLAG): Provide default.
        (main): Use it.
        * doc/tm.texi (COLLECT_PARSE_FLAG): Document it.
index 907d480..ee4a2cc 100644 (file)
@@ -1377,7 +1377,10 @@ mips-sgi-irix6*o32)              # SGI System V.4., IRIX 6, O32 ABI
        target_cpu_default="MASK_ABICALLS"
        # mips-tfile doesn't work yet
        # See comment in mips/iris5.h file.
-       use_collect2=yes
+       if test x$gas = xno
+       then
+               use_collect2=yes
+       fi
 #      if test x$enable_threads = xyes; then
 #              thread_file='irix'
 #      fi
@@ -1385,6 +1388,10 @@ mips-sgi-irix6*o32)              # SGI System V.4., IRIX 6, O32 ABI
        ;;
 mips-sgi-irix6*)               # SGI System V.4., IRIX 6
        tm_file="${tm_file} mips/iris5.h mips/iris6.h"
+       if test x$gas = xyes
+       then
+               tm_file="${tm_file} mips/iris6gas.h"
+       fi
        if test "x$gnu_ld" = xyes
        then
                tm_file="${tm_file} mips/iris6gld.h"
@@ -1392,6 +1399,12 @@ mips-sgi-irix6*)         # SGI System V.4., IRIX 6
        tmake_file="mips/t-iris mips/t-iris5-6 mips/t-iris6"
        target_cpu_default="MASK_ABICALLS|MASK_FLOAT64|MASK_64BIT"
        tm_defines="MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_N32"
+       # See comment in mips/iris5.h file.  Only enabled for O32 ABI
+       # without GNU as.
+       if test x$gas = xno
+       then
+               use_collect2=yes
+       fi
 #      if test x$enable_threads = xyes; then
 #              thread_file='irix'
 #      fi
index dcc7ecb..41de652 100644 (file)
@@ -19,6 +19,12 @@ 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.  */
 
+/* We are compiling for IRIX now.  */
+#undef TARGET_IRIX
+#define TARGET_IRIX 1
+
+/* Allow some special handling for IRIX 5.  */
+#undef TARGET_IRIX5
 #define TARGET_IRIX5 1
 
 #define ABICALLS_ASM_OP "\t.option pic2"
@@ -203,20 +209,9 @@ do {                                                               \
   fputs ("\n", (FILE));                                                \
 } while (0)
 
-/* In IRIX 5, we must output a `.global name .text' directive for every used
-   but undefined function.  If we don't, the linker may perform an optimization
-   (skipping over the insns that set $gp) when it is unsafe.  This is used
-   indirectly by ASM_OUTPUT_EXTERNAL.  */
-#define ASM_OUTPUT_UNDEF_FUNCTION(FILE, NAME)  \
-do {                                           \
-  fputs ("\t.globl ", FILE);                   \
-  assemble_name (FILE, NAME);                  \
-  fputs (" .text\n", FILE);                    \
-} while (0)
-
 /* Also do this for libcalls.  */
 #undef TARGET_ASM_EXTERNAL_LIBCALL
-#define TARGET_ASM_EXTERNAL_LIBCALL mips_output_external_libcall
+#define TARGET_ASM_EXTERNAL_LIBCALL irix_output_external_libcall
 
 /* This does for functions what ASM_DECLARE_OBJECT_NAME does for variables.
    This is used indirectly by ASM_OUTPUT_EXTERNAL.  */
index f94d1ac..27b3118 100644 (file)
@@ -76,5 +76,8 @@ do {                                                  \
 #define NM_FLAGS "-Bng"
 
 /* Disable SHF_MERGE support.  Even if gas supports it, the IRIX ld does not
-   without a special elspec(5) file.  */
+   without a special elspec(5) file.
+
+   FIXME: Only do this if not using GNU ld.  */
 #undef HAVE_GAS_SHF_MERGE
+#define HAVE_GAS_SHF_MERGE 0
index b0b59b6..d708bcf 100644 (file)
@@ -19,16 +19,18 @@ 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.  */
 
-/* Let mips.c know we need the IRIX 6 functions.  */
-#define TARGET_IRIX6 1
+/* No more special IRIX 5 handling.  */
+#undef TARGET_IRIX5
+#define TARGET_IRIX5 0
 
 /* Default to -mabi=n32 and -mips3.  */
 #undef MULTILIB_DEFAULTS
 #define MULTILIB_DEFAULTS { "mabi=n32" }
 
-/* IRIX 6 assembler does handle DWARF2 directives.  Override setting in
-   iris5.h file.  */
+/* The IRIX 6 O32 assembler cannot calculate label differences, while both
+   the N32/N64 assembler and gas can.  Override setting in iris5.h file.  */
 #undef DWARF2_UNWIND_INFO
+#define DWARF2_UNWIND_INFO !TARGET_SGI_O32_AS
 
 /* The IRIX 6 assembler will sometimes assign labels to the wrong
    section unless the labels are within .ent/.end blocks.  Therefore,
@@ -54,8 +56,9 @@ Boston, MA 02111-1307, USA.  */
 /* For IRIX 6, -mabi=64 implies TARGET_LONG64.  */
 /* This is handled in override_options.  */
 
+/* Default to the mips2 ISA for the O32 ABI.  */
 #undef SUBTARGET_CC1_SPEC
-#define SUBTARGET_CC1_SPEC ""
+#define SUBTARGET_CC1_SPEC "%{mabi=32: %{!mips*: -mips2}}"
 
 /* #line directives let the O32 assembler create object files that cause the
    O32 linker to crash.  */
@@ -91,7 +94,8 @@ Boston, MA 02111-1307, USA.  */
                                                        \
      if (mips_abi == ABI_32)                           \
       {                                                        \
-       builtin_define ("_MIPS_SIM=_MIPS_SIM_ABI32");   \
+       builtin_define ("_ABIO32=1");                   \
+       builtin_define ("_MIPS_SIM=_ABIO32");           \
        builtin_define ("_MIPS_SZLONG=32");             \
        builtin_define ("_MIPS_SZPTR=32");              \
       }                                                        \
@@ -151,7 +155,7 @@ Boston, MA 02111-1307, USA.  */
 
 /* 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
+#define DWARF2_FRAME_INFO !TARGET_SGI_O32_AS
 
 /* 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
@@ -180,11 +184,6 @@ Boston, MA 02111-1307, USA.  */
 #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_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
@@ -193,25 +192,38 @@ Boston, MA 02111-1307, USA.  */
 #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);                                             \
+    if (mips_abi != ABI_32)                                            \
+      {                                                                        \
+        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.  */
+#undef ASM_DECLARE_FUNCTION_SIZE
 #define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL)                  \
   do {                                                                 \
-    fputs ("\t.end\t", STREAM);                                                \
-    assemble_name (STREAM, NAME);                                      \
-    fputs ("\n", STREAM);                                              \
+    if (mips_abi == ABI_32)                                            \
+      {                                                                        \
+        tree name_tree = get_identifier (NAME);                                \
+        TREE_ASM_WRITTEN (name_tree) = 1;                              \
+      }                                                                \
+    else                                                               \
+      {                                                                        \
+        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 FUNCTION_NAME_ALREADY_DECLARED
+#define FUNCTION_NAME_ALREADY_DECLARED (mips_abi != ABI_32)
 
 #undef SET_ASM_OP      /* Has no equivalent.  See ASM_OUTPUT_DEF below.  */
 
@@ -248,7 +260,7 @@ Boston, MA 02111-1307, USA.  */
    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|mabi=64:-mips3}}"
+#define SUBTARGET_ASM_SPEC "%{!mabi*:-n32} %{mabi=32:-32} %{!mips*: %{!mabi*:-mips3} %{mabi=32:-mips2} %{mabi=n32|mabi=64:-mips3}}"
 
 /* Must pass -g0 to the assembler, otherwise it may overwrite our
    debug info with its own debug info.  */
@@ -262,7 +274,7 @@ Boston, MA 02111-1307, USA.  */
 #define SUBTARGET_MIPS_AS_ASM_SPEC "%{v:-show} -G 0 -w"
 
 #undef SUBTARGET_ASM_DEBUGGING_SPEC
-#define SUBTARGET_ASM_DEBUGGING_SPEC "-g0"
+#define SUBTARGET_ASM_DEBUGGING_SPEC "-g0 %(mdebug_asm_spec)"
 
 /* The MIPS assembler occasionally misoptimizes.  Since GCC should be
    doing scheduling anyhow, just turn off optimization in the assembler.  */
@@ -275,7 +287,12 @@ Boston, MA 02111-1307, USA.  */
    and dtor lists this way, so we use -init and -fini to invoke the
    do_global_* functions instead of running collect2.  */
 
-#define BSS_SECTION_ASM_OP     "\t.section\t.bss"
+#define BSS_SECTION_ASM_OP_32  "\t.data"
+#define BSS_SECTION_ASM_OP_64  "\t.section\t.bss"
+#define BSS_SECTION_ASM_OP                     \
+  (mips_abi != ABI_32 && mips_abi != ABI_O64   \
+   ? BSS_SECTION_ASM_OP_64                     \
+   : BSS_SECTION_ASM_OP_32)
 
 #undef READONLY_DATA_SECTION_ASM_OP
 #define READONLY_DATA_SECTION_ASM_OP_32        "\t.rdata"
@@ -285,8 +302,41 @@ Boston, MA 02111-1307, USA.  */
    ? READONLY_DATA_SECTION_ASM_OP_64           \
    : READONLY_DATA_SECTION_ASM_OP_32)
 
+/* Switch into a generic section.  */
+#undef TARGET_ASM_NAMED_SECTION
+#define TARGET_ASM_NAMED_SECTION  irix_asm_named_section
+
+/* The default definition in defaults.h cannot cope with the runtime-variable
+   definition of DWARF2_UNWIND_INFO above, so define here explicitly.  */
+#define EH_FRAME_SECTION_NAME ".eh_frame"
+
+/* MUST_USE_SJLJ_EXCEPTIONS has the same problem.  */
+#define MUST_USE_SJLJ_EXCEPTIONS (DWARF2_UNWIND_INFO == 0)
+
+/* The native IRIX 6 O32 assembler doesn't support named sections, while
+   the N32/N64 assembler does.  We need crt{begin, end}.o for the N32/N64
+   ABIs, but there's no way to disable them for just one multilib.
+   Therefore we provide dummy definitions to allow crtstuff.c to compile,
+   but the resulting files are not used for the O32 ABI.  */
+
+#if (defined _ABIO32 && _MIPS_SIM == _ABIO32) \
+  && ((TARGET_CPU_DEFAULT | TARGET_DEFAULT) & MASK_GAS) == 0
+
+/* Provide dummy definitions.  */
+#define CTORS_SECTION_ASM_OP ""
+#define DTORS_SECTION_ASM_OP ""
+
+/* Undef so JCR_SECTION_NAME isn't defined and __JCR_{LIST, END}__ are not
+   used.  */
+#undef TARGET_ASM_NAMED_SECTION
+
+/* Undef so __EH_FRAME_BEGIN__/__FRAME_END__ are not used.  */
+#undef EH_FRAME_SECTION_NAME
+
+#endif /* _MIPS_SIM == _ABIO32 && !GAS */
+
 /* Define functions to read the name and flags of the current section.
-   They are used by iris6_asm_output_align.  */
+   They are used by irix_asm_output_align.  */
 
 #undef EXTRA_SECTION_FUNCTIONS
 #define EXTRA_SECTION_FUNCTIONS                                                \
@@ -325,13 +375,9 @@ current_section_flags (void)                                               \
   abort ();                                                            \
 }
 
-/* Switch into a generic section.  */
-#undef TARGET_ASM_NAMED_SECTION
-#define TARGET_ASM_NAMED_SECTION  iris6_asm_named_section
-
 /* SGI assembler needs all sorts of extra help to do alignment properly.  */
 #undef ASM_OUTPUT_ALIGN
-#define ASM_OUTPUT_ALIGN iris6_asm_output_align
+#define ASM_OUTPUT_ALIGN irix_asm_output_align
 
 #undef MAX_OFILE_ALIGNMENT
 #define MAX_OFILE_ALIGNMENT (32768*8)
@@ -343,7 +389,10 @@ current_section_flags (void)                                               \
 #define ASM_OUTPUT_FILENAME(STREAM, NUM_SOURCE_FILENAMES, NAME) \
 do                                                             \
   {                                                            \
-    fprintf (STREAM, "\t#.file\t%d ", NUM_SOURCE_FILENAMES);   \
+    if (mips_abi == ABI_32)                                    \
+      fprintf (STREAM, "\t.file\t%d ", NUM_SOURCE_FILENAMES);  \
+    else                                                       \
+      fprintf (STREAM, "\t#.file\t%d ", NUM_SOURCE_FILENAMES); \
     output_quoted_string (STREAM, NAME);                       \
     fputs ("\n", STREAM);                                      \
   }                                                            \
@@ -457,10 +506,19 @@ while (0)
 %{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
 %{bestGnum} %{shared} %{non_shared} \
 %{call_shared} %{no_archive} %{exact_version} %{w} \
-%{!shared: %{!non_shared: %{!call_shared: -call_shared -no_unresolved}}} \
-%{rpath} -init __do_global_ctors -fini __do_global_dtors \
+%{!shared: %{!non_shared: %{!call_shared:%{!r: -call_shared -no_unresolved}}}} \
+%{rpath} %{!mabi=32: -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}"
 
+/* We need to disable collecting for the N32 and N64 ABIs.  */
+#define COLLECT_PARSE_FLAG(FLAG)                               \
+do {                                                           \
+  if (! strcmp (FLAG, "-n32") || ! strcmp (FLAG, "-64"))       \
+    do_collecting = 0;                                         \
+  if (! strcmp (FLAG, "-32") || ! strcmp (FLAG, "-o32"))       \
+    do_collecting = 1;                                         \
+} while (0)
+
 #define MIPS_TFMODE_FORMAT mips_extended_format
diff --git a/gcc/config/mips/iris6gas.h b/gcc/config/mips/iris6gas.h
new file mode 100644 (file)
index 0000000..e73bfaf
--- /dev/null
@@ -0,0 +1,32 @@
+/* Definitions of target machine for GNU compiler.  IRIX 6 with GNU as.  */
+
+/* Override mips.h version to match DWARF 2 default.  */
+#undef MDEBUG_ASM_SPEC
+#define MDEBUG_ASM_SPEC "%{gstabs*|gcoff*:-mdebug} \
+%{!gstabs*:%{!gcoff*:-no-mdebug}}"
+
+/* Override iris6.h version to always use -init/-fini.
+
+   FIXME: integrate those use separate spec/define for this?  */
+#undef LINK_SPEC
+#define LINK_SPEC "\
+%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
+%{bestGnum} %{shared} %{non_shared} \
+%{call_shared} %{no_archive} %{exact_version} %{w} \
+%{!shared: %{!non_shared: %{!call_shared:%{!r: -call_shared -no_unresolved}}}} \
+%{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}"
+
+/* Disable SHF_MERGE support.  Even if gas supports it, the IRIX 6 O32 ld
+   does not without a special elspec(5) file.
+
+   FIXME: Only do this if not using GNU ld.  */
+#if HAVE_GAS_SHF_MERGE
+#undef HAVE_GAS_SHF_MERGE
+#define HAVE_GAS_SHF_MERGE (mips_abi != ABI_32)
+#endif /* HAVE_GAS_SHF_MERGE */
+
+/* There's no need to perform collecting with GNU as.  */
+#undef COLLECT_PARSE_FLAG
index 8712242..ad2aa18 100644 (file)
@@ -171,7 +171,7 @@ Boston, MA 02111-1307, USA.  */
 
 /* Tell function_prologue in mips.c that we have already output the .ent/.end
    pseudo-ops.  */
-#define FUNCTION_NAME_ALREADY_DECLARED
+#define FUNCTION_NAME_ALREADY_DECLARED 1
 
 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL)                     \
   (flag_pic                                                            \
index 3e3e414..2e31138 100644 (file)
@@ -98,8 +98,8 @@ extern HOST_WIDE_INT mips_debugger_offset (rtx, HOST_WIDE_INT);
 extern void print_operand (FILE *, rtx, int);
 extern void print_operand_address (FILE *, rtx);
 extern int mips_output_external (FILE *, tree, const char *);
-#if TARGET_IRIX5 || TARGET_IRIX6
-extern void mips_output_external_libcall (rtx);
+#if TARGET_IRIX
+extern void irix_output_external_libcall (rtx);
 #endif
 extern void mips_output_filename (FILE *, const char *);
 extern void mips_output_lineno (FILE *, int);
@@ -141,7 +141,7 @@ extern unsigned int mips_hard_regno_nregs (int, enum machine_mode);
 extern int mips_return_in_memory (tree);
 extern const char *mips_emit_prefetch (rtx *);
 
-extern void iris6_asm_output_align (FILE *, unsigned);
+extern void irix_asm_output_align (FILE *, unsigned);
 extern const char *current_section_name (void);
 extern unsigned int current_section_flags (void);
 
index 71fd880..b79ce0e 100644 (file)
@@ -276,17 +276,17 @@ static int mips_issue_rate (void);
 static int mips_use_dfa_pipeline_interface (void);
 static void mips_init_libfuncs (void);
 
-#ifdef TARGET_IRIX6
-static void iris6_asm_named_section_1 (const char *, unsigned int,
-                                      unsigned int);
-static void iris6_asm_named_section (const char *, unsigned int);
-static int iris_section_align_entry_eq (const void *, const void *);
-static hashval_t iris_section_align_entry_hash (const void *);
-static void iris6_file_start (void);
-static int iris6_section_align_1 (void **, void *);
+#if TARGET_IRIX
+static void irix_asm_named_section_1 (const char *, unsigned int,
+                                     unsigned int);
+static void irix_asm_named_section (const char *, unsigned int);
+static int irix_section_align_entry_eq (const void *, const void *);
+static hashval_t irix_section_align_entry_hash (const void *);
+static void irix_file_start (void);
+static int irix_section_align_1 (void **, void *);
 static void copy_file_data (FILE *, FILE *);
-static void iris6_file_end (void);
-static unsigned int iris6_section_type_flags (tree, const char *, int);
+static void irix_file_end (void);
+static unsigned int irix_section_type_flags (tree, const char *, int);
 #endif
 
 /* Structure to be filled in by compute_frame_size with register
@@ -738,17 +738,6 @@ const struct mips_cpu_info mips_cpu_info_table[] = {
 #undef TARGET_ASM_INTEGER
 #define TARGET_ASM_INTEGER mips_assemble_integer
 
-#if TARGET_IRIX5 && !TARGET_IRIX6
-#undef TARGET_ASM_UNALIGNED_HI_OP
-#define TARGET_ASM_UNALIGNED_HI_OP "\t.align 0\n\t.half\t"
-#undef TARGET_ASM_UNALIGNED_SI_OP
-#define TARGET_ASM_UNALIGNED_SI_OP "\t.align 0\n\t.word\t"
-/* The IRIX 6 O32 assembler gives an error for `align 0; .dword', contrary
-   to the documentation, so disable it.  */
-#undef TARGET_ASM_UNALIGNED_DI_OP
-#define TARGET_ASM_UNALIGNED_DI_OP NULL
-#endif
-
 #undef TARGET_ASM_FUNCTION_PROLOGUE
 #define TARGET_ASM_FUNCTION_PROLOGUE mips_output_function_prologue
 #undef TARGET_ASM_FUNCTION_EPILOGUE
@@ -785,9 +774,9 @@ const struct mips_cpu_info mips_cpu_info_table[] = {
 
 #undef TARGET_ASM_FILE_START
 #undef TARGET_ASM_FILE_END
-#ifdef TARGET_IRIX6
-#define TARGET_ASM_FILE_START iris6_file_start
-#define TARGET_ASM_FILE_END iris6_file_end
+#if TARGET_IRIX
+#define TARGET_ASM_FILE_START irix_file_start
+#define TARGET_ASM_FILE_END irix_file_end
 #else
 #define TARGET_ASM_FILE_START mips_file_start
 #define TARGET_ASM_FILE_END mips_file_end
@@ -795,9 +784,9 @@ const struct mips_cpu_info mips_cpu_info_table[] = {
 #undef TARGET_ASM_FILE_START_FILE_DIRECTIVE
 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
 
-#ifdef TARGET_IRIX6
+#if TARGET_IRIX
 #undef TARGET_SECTION_TYPE_FLAGS
-#define TARGET_SECTION_TYPE_FLAGS iris6_section_type_flags
+#define TARGET_SECTION_TYPE_FLAGS irix_section_type_flags
 #endif
 
 #undef TARGET_INIT_LIBFUNCS
@@ -4705,6 +4694,60 @@ override_options (void)
   if (mips_abi != ABI_32 && mips_abi != ABI_O64)
     flag_pcc_struct_return = 0;
 
+#if defined(USE_COLLECT2)
+  /* For IRIX 5 or IRIX 6 with integrated O32 ABI support, USE_COLLECT2 is
+     always defined when GNU as is not in use, but collect2 is only used
+     for the O32 ABI, so override the toplev.c and target-def.h defaults
+     for flag_gnu_linker, TARGET_ASM_{CONSTRUCTOR, DESTRUCTOR} and
+     TARGET_HAVE_CTORS_DTORS.
+
+     Since the IRIX 5 and IRIX 6 O32 assemblers cannot handle named
+     sections, constructor/destructor handling depends on the ABI in use.
+
+     Since USE_COLLECT2 is defined, we only need to restore the non-collect2
+     defaults for the N32/N64 ABIs.  */
+  if (TARGET_IRIX && !TARGET_SGI_O32_AS)
+    {
+      flag_gnu_linker = 1;
+
+      targetm.have_ctors_dtors = true;
+      targetm.asm_out.constructor = default_named_section_asm_out_constructor;
+      targetm.asm_out.destructor = default_named_section_asm_out_destructor;
+    }
+#endif
+
+  /* Handle some quirks of the IRIX 5 and IRIX 6 O32 assemblers.  */
+
+  if (TARGET_SGI_O32_AS)
+    {
+      /* They don't recognize `.[248]byte'. */
+      targetm.asm_out.unaligned_op.hi = "\t.align 0\n\t.half\t";
+      targetm.asm_out.unaligned_op.si = "\t.align 0\n\t.word\t";
+      /* The IRIX 6 O32 assembler gives an error for `align 0; .dword',
+        contrary to the documentation, so disable it.  */
+      targetm.asm_out.unaligned_op.di = NULL;
+
+      /* They cannot handle named sections.  */
+      targetm.have_named_sections = false;
+      /* Therefore, EH_FRAME_SECTION_NAME isn't defined and we must use
+        collect2.  */
+      targetm.terminate_dw2_eh_frame_info = true;
+      targetm.asm_out.eh_frame_section = collect2_eh_frame_section;
+
+      /* They cannot handle debug information.  */
+      if (write_symbols != NO_DEBUG)
+       {
+         /* Adapt wording to IRIX version: IRIX 5 only had a single ABI,
+            so -mabi=32 isn't usually specified.  */
+         if (TARGET_IRIX5)
+           warning ("-g is only supported using GNU as,");
+         else
+           warning ("-g is only supported using GNU as with -mabi=32,");
+         warning ("-g option disabled");
+         write_symbols = NO_DEBUG;
+       }
+    }
+
   if ((target_flags_explicit & MASK_BRANCHLIKELY) == 0)
     {
       /* If neither -mbranch-likely nor -mno-branch-likely was given
@@ -5571,8 +5614,8 @@ mips_output_external (FILE *file ATTRIBUTE_UNUSED, tree decl, const char *name)
       extern_head = p;
     }
 
-#ifdef ASM_OUTPUT_UNDEF_FUNCTION
-  if (TREE_CODE (decl) == FUNCTION_DECL
+  if (TARGET_IRIX && mips_abi == ABI_32
+      && TREE_CODE (decl) == FUNCTION_DECL
       /* ??? Don't include alloca, since gcc will always expand it
         inline.  If we don't do this, the C++ library fails to build.  */
       && strcmp (name, "alloca")
@@ -5586,14 +5629,13 @@ mips_output_external (FILE *file ATTRIBUTE_UNUSED, tree decl, const char *name)
       p->size = -1;
       extern_head = p;
     }
-#endif
 
   return 0;
 }
 
-#if TARGET_IRIX5 || TARGET_IRIX6
+#if TARGET_IRIX
 void
-mips_output_external_libcall (rtx fun)
+irix_output_external_libcall (rtx fun)
 {
   register struct extern_list *p;
 
@@ -5763,7 +5805,7 @@ mips_file_start (void)
 
   if (TARGET_GAS)
     {
-#if defined(OBJECT_FORMAT_ELF) && !(TARGET_IRIX5 || TARGET_IRIX6)
+#if defined(OBJECT_FORMAT_ELF) && !TARGET_IRIX
       /* Generate a special section to describe the ABI switches used to
         produce the resultant binary.  This used to be done by the assembler
         setting bits in the ELF header's flags field, but we have run out of
@@ -5853,11 +5895,18 @@ mips_file_end (void)
          if (! TREE_ASM_WRITTEN (name_tree))
            {
              TREE_ASM_WRITTEN (name_tree) = 1;
-#ifdef ASM_OUTPUT_UNDEF_FUNCTION
-             if (p->size == -1)
-               ASM_OUTPUT_UNDEF_FUNCTION (asm_out_file, p->name);
+             /* In IRIX 5 or IRIX 6 for the O32 ABI, we must output a
+                `.global name .text' directive for every used but
+                undefined function.  If we don't, the linker may perform
+                an optimization (skipping over the insns that set $gp)
+                when it is unsafe.  */
+             if (TARGET_IRIX && mips_abi == ABI_32 && p->size == -1)
+               {
+                 fputs ("\t.globl ", asm_out_file);                   
+                 assemble_name (asm_out_file, p->name);
+                 fputs (" .text\n", asm_out_file);
+               }
              else
-#endif
                {
                  fputs ("\t.extern\t", asm_out_file);
                  assemble_name (asm_out_file, p->name);
@@ -5897,18 +5946,21 @@ void
 mips_declare_object_name (FILE *stream, const char *name,
                          tree decl ATTRIBUTE_UNUSED)
 {
+  if (!TARGET_SGI_O32_AS)
+    {
 #ifdef ASM_OUTPUT_TYPE_DIRECTIVE
-  ASM_OUTPUT_TYPE_DIRECTIVE (stream, name, "object");
+      ASM_OUTPUT_TYPE_DIRECTIVE (stream, name, "object");
 #endif
 
-  size_directive_output = 0;
-  if (!flag_inhibit_size_directive && DECL_SIZE (decl))
-    {
-      HOST_WIDE_INT size;
+      size_directive_output = 0;
+      if (!flag_inhibit_size_directive && DECL_SIZE (decl))
+       {
+         HOST_WIDE_INT size;
 
-      size_directive_output = 1;
-      size = int_size_in_bytes (TREE_TYPE (decl));
-      ASM_OUTPUT_SIZE_DIRECTIVE (stream, name, size);
+         size_directive_output = 1;
+         size = int_size_in_bytes (TREE_TYPE (decl));
+         ASM_OUTPUT_SIZE_DIRECTIVE (stream, name, size);
+       }
     }
 
   mips_declare_object (stream, name, "", ":\n", 0);
@@ -5922,7 +5974,8 @@ mips_finish_declare_object (FILE *stream, tree decl, int top_level, int at_end)
   const char *name;
 
   name = XSTR (XEXP (DECL_RTL (decl), 0), 0);
-  if (!flag_inhibit_size_directive
+  if (!TARGET_SGI_O32_AS
+      && !flag_inhibit_size_directive
       && DECL_SIZE (decl) != 0
       && !at_end && top_level
       && DECL_INITIAL (decl) == error_mark_node
@@ -6329,9 +6382,7 @@ mips_for_each_saved_reg (HOST_WIDE_INT sp_offset, mips_save_restore_fn fn)
 static void
 mips_output_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED)
 {
-#ifndef FUNCTION_NAME_ALREADY_DECLARED
   const char *fnname;
-#endif
   HOST_WIDE_INT tsize = cfun->machine->frame.total_size;
 
   /* ??? When is this really needed?  At least the GNU assembler does not
@@ -6353,23 +6404,24 @@ mips_output_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED)
       && current_function_args_info.fp_code != 0)
     build_mips16_function_stub (file);
 
-#ifndef FUNCTION_NAME_ALREADY_DECLARED
-  /* Get the function name the same way that toplev.c does before calling
-     assemble_start_function.  This is needed so that the name used here
-     exactly matches the name used in ASM_DECLARE_FUNCTION_NAME.  */
-  fnname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
-
-  if (!flag_inhibit_size_directive)
+  if (!FUNCTION_NAME_ALREADY_DECLARED)
     {
-      fputs ("\t.ent\t", file);
+      /* Get the function name the same way that toplev.c does before calling
+        assemble_start_function.  This is needed so that the name used here
+        exactly matches the name used in ASM_DECLARE_FUNCTION_NAME.  */
+      fnname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
+
+      if (!flag_inhibit_size_directive)
+       {
+         fputs ("\t.ent\t", file);
+         assemble_name (file, fnname);
+         fputs ("\n", file);
+       }
+
       assemble_name (file, fnname);
-      fputs ("\n", file);
+      fputs (":\n", file);
     }
 
-  assemble_name (file, fnname);
-  fputs (":\n", file);
-#endif
-
   if (!flag_inhibit_size_directive)
     {
       /* .frame FRAMEREG, FRAMESIZE, RETREG */
@@ -6627,8 +6679,7 @@ mips_output_function_epilogue (FILE *file ATTRIBUTE_UNUSED,
       set_noreorder = set_nomacro = 0;
     }
 
-#ifndef FUNCTION_NAME_ALREADY_DECLARED
-  if (!flag_inhibit_size_directive)
+  if (!FUNCTION_NAME_ALREADY_DECLARED && !flag_inhibit_size_directive)
     {
       const char *fnname;
 
@@ -6640,7 +6691,6 @@ mips_output_function_epilogue (FILE *file ATTRIBUTE_UNUSED,
       assemble_name (file, fnname);
       fputs ("\n", file);
     }
-#endif
 
   while (string_constants != NULL)
     {
@@ -7521,11 +7571,12 @@ build_mips16_function_stub (FILE *file)
 
   /* ??? If FUNCTION_NAME_ALREADY_DECLARED is defined, then we are
      within a .ent, and we can not emit another .ent.  */
-#ifndef FUNCTION_NAME_ALREADY_DECLARED
-  fputs ("\t.ent\t", file);
-  assemble_name (file, stubname);
-  fputs ("\n", file);
-#endif
+  if (!FUNCTION_NAME_ALREADY_DECLARED)
+    {
+      fputs ("\t.ent\t", file);
+      assemble_name (file, stubname);
+      fputs ("\n", file);
+    }
 
   assemble_name (file, stubname);
   fputs (":\n", file);
@@ -7551,11 +7602,12 @@ build_mips16_function_stub (FILE *file)
 
   fprintf (file, "\t.set\treorder\n");
 
-#ifndef FUNCTION_NAME_ALREADY_DECLARED
-  fputs ("\t.end\t", file);
-  assemble_name (file, stubname);
-  fputs ("\n", file);
-#endif
+  if (!FUNCTION_NAME_ALREADY_DECLARED)
+    {
+      fputs ("\t.end\t", file);
+      assemble_name (file, stubname);
+      fputs ("\n", file);
+    }
 
   fprintf (file, "\t.set\tmips16\n");
 
@@ -7750,14 +7802,15 @@ build_mips16_call_stub (rtx retval, rtx fn, rtx arg_size, int fp_code)
       fprintf (asm_out_file, "\t.set\tnomips16\n");
       assemble_start_function (stubdecl, stubname);
 
-#ifndef FUNCTION_NAME_ALREADY_DECLARED
-      fputs ("\t.ent\t", asm_out_file);
-      assemble_name (asm_out_file, stubname);
-      fputs ("\n", asm_out_file);
+      if (!FUNCTION_NAME_ALREADY_DECLARED)
+       {
+         fputs ("\t.ent\t", asm_out_file);
+         assemble_name (asm_out_file, stubname);
+         fputs ("\n", asm_out_file);
 
-      assemble_name (asm_out_file, stubname);
-      fputs (":\n", asm_out_file);
-#endif
+         assemble_name (asm_out_file, stubname);
+         fputs (":\n", asm_out_file);
+       }
 
       /* We build the stub code by hand.  That's the only way we can
         do it, since we can't generate 32 bit code during a 16 bit
@@ -7824,11 +7877,12 @@ build_mips16_call_stub (rtx retval, rtx fn, rtx arg_size, int fp_code)
       ASM_DECLARE_FUNCTION_SIZE (asm_out_file, stubname, stubdecl);
 #endif
 
-#ifndef FUNCTION_NAME_ALREADY_DECLARED
-      fputs ("\t.end\t", asm_out_file);
-      assemble_name (asm_out_file, stubname);
-      fputs ("\n", asm_out_file);
-#endif
+      if (!FUNCTION_NAME_ALREADY_DECLARED)
+       {
+         fputs ("\t.end\t", asm_out_file);
+         assemble_name (asm_out_file, stubname);
+         fputs ("\n", asm_out_file);
+       }
 
       fprintf (asm_out_file, "\t.set\tmips16\n");
 
@@ -9222,11 +9276,11 @@ mips_emit_prefetch (rtx *operands)
 
 
 \f
-#ifdef TARGET_IRIX6
+#if TARGET_IRIX
 /* Output assembly to switch to section NAME with attribute FLAGS.  */
 
 static void
-iris6_asm_named_section_1 (const char *name, unsigned int flags,
+irix_asm_named_section_1 (const char *name, unsigned int flags,
                           unsigned int align)
 {
   unsigned int sh_type, sh_flags, sh_entsize;
@@ -9259,92 +9313,103 @@ iris6_asm_named_section_1 (const char *name, unsigned int flags,
 }
 
 static void
-iris6_asm_named_section (const char *name, unsigned int flags)
+irix_asm_named_section (const char *name, unsigned int flags)
 {
-  iris6_asm_named_section_1 (name, flags, 0);
+  if (TARGET_SGI_O32_AS)
+    default_no_named_section (name, flags);
+  else if (mips_abi == ABI_32 && TARGET_GAS)
+    default_elf_asm_named_section (name, flags);
+  else
+    irix_asm_named_section_1 (name, flags, 0);
 }
 
 /* In addition to emitting a .align directive, record the maximum
    alignment requested for the current section.  */
 
-struct GTY (()) iris_section_align_entry
+struct GTY (()) irix_section_align_entry
 {
   const char *name;
   unsigned int log;
   unsigned int flags;
 };
 
-static htab_t iris_section_align_htab;
-static FILE *iris_orig_asm_out_file;
+static htab_t irix_section_align_htab;
+static FILE *irix_orig_asm_out_file;
 
 static int
-iris_section_align_entry_eq (const void *p1, const void *p2)
+irix_section_align_entry_eq (const void *p1, const void *p2)
 {
-  const struct iris_section_align_entry *old = p1;
+  const struct irix_section_align_entry *old = p1;
   const char *new = p2;
 
   return strcmp (old->name, new) == 0;
 }
 
 static hashval_t
-iris_section_align_entry_hash (const void *p)
+irix_section_align_entry_hash (const void *p)
 {
-  const struct iris_section_align_entry *old = p;
+  const struct irix_section_align_entry *old = p;
   return htab_hash_string (old->name);
 }
 
 void
-iris6_asm_output_align (FILE *file, unsigned int log)
+irix_asm_output_align (FILE *file, unsigned int log)
 {
   const char *section = current_section_name ();
-  struct iris_section_align_entry **slot, *entry;
-
-  if (! section)
-    abort ();
+  struct irix_section_align_entry **slot, *entry;
 
-  slot = (struct iris_section_align_entry **)
-    htab_find_slot_with_hash (iris_section_align_htab, section,
-                             htab_hash_string (section), INSERT);
-  entry = *slot;
-  if (! entry)
+  if (mips_abi != ABI_32)
     {
-      entry = (struct iris_section_align_entry *)
-       xmalloc (sizeof (struct iris_section_align_entry));
-      *slot = entry;
-      entry->name = section;
-      entry->log = log;
-      entry->flags = current_section_flags ();
+      if (! section)
+       abort ();
+
+      slot = (struct irix_section_align_entry **)
+       htab_find_slot_with_hash (irix_section_align_htab, section,
+                                 htab_hash_string (section), INSERT);
+      entry = *slot;
+      if (! entry)
+       {
+         entry = (struct irix_section_align_entry *)
+           xmalloc (sizeof (struct irix_section_align_entry));
+         *slot = entry;
+         entry->name = section;
+         entry->log = log;
+         entry->flags = current_section_flags ();
+       }
+      else if (entry->log < log)
+       entry->log = log;
     }
-  else if (entry->log < log)
-    entry->log = log;
 
   fprintf (file, "\t.align\t%u\n", log);
 }
 
-/* The Iris assembler does not record alignment from .align directives,
+/* The IRIX assembler does not record alignment from .align directives,
    but takes it from the first .section directive seen.  Play file
    switching games so that we can emit a .section directive at the
    beginning of the file with the proper alignment attached.  */
 
 static void
-iris6_file_start (void)
+irix_file_start (void)
 {
   mips_file_start ();
 
-  iris_orig_asm_out_file = asm_out_file;
+  if (mips_abi == ABI_32)
+    return;
+
+  irix_orig_asm_out_file = asm_out_file;
   asm_out_file = tmpfile ();
 
-  iris_section_align_htab = htab_create (31, iris_section_align_entry_hash,
-                                        iris_section_align_entry_eq, NULL);
+  irix_section_align_htab = htab_create (31, irix_section_align_entry_hash,
+                                        irix_section_align_entry_eq, NULL);
 }
 
 static int
-iris6_section_align_1 (void **slot, void *data ATTRIBUTE_UNUSED)
+irix_section_align_1 (void **slot, void *data ATTRIBUTE_UNUSED)
 {
-  const struct iris_section_align_entry *entry
-    = *(const struct iris_section_align_entry **) slot;
+  const struct irix_section_align_entry *entry
+    = *(const struct irix_section_align_entry **) slot;
 
-  iris6_asm_named_section_1 (entry->name, entry->flags, 1 << entry->log);
+  irix_asm_named_section_1 (entry->name, entry->flags, 1 << entry->log);
   return 1;
 }
 
@@ -9369,16 +9434,19 @@ copy_file_data (FILE *to, FILE *from)
 }
 
 static void
-iris6_file_end (void)
+irix_file_end (void)
 {
-  /* Emit section directives with the proper alignment at the top of the
-     real output file.  */
-  FILE *temp = asm_out_file;
-  asm_out_file = iris_orig_asm_out_file;
-  htab_traverse (iris_section_align_htab, iris6_section_align_1, NULL);
+  if (mips_abi != ABI_32)
+    {
+      /* Emit section directives with the proper alignment at the top of the
+        real output file.  */
+      FILE *temp = asm_out_file;
+      asm_out_file = irix_orig_asm_out_file;
+      htab_traverse (irix_section_align_htab, irix_section_align_1, NULL);
 
-  /* Copy the data emitted to the temp file to the real output file.  */
-  copy_file_data (asm_out_file, temp);
+      /* Copy the data emitted to the temp file to the real output file.  */
+      copy_file_data (asm_out_file, temp);
+    }
 
   mips_file_end ();
 }
@@ -9389,7 +9457,7 @@ iris6_file_end (void)
    default code.  */
 
 static unsigned int
-iris6_section_type_flags (tree decl, const char *section, int relocs_p)
+irix_section_type_flags (tree decl, const char *section, int relocs_p)
 {
   unsigned int flags;
 
@@ -9404,7 +9472,6 @@ iris6_section_type_flags (tree decl, const char *section, int relocs_p)
   return flags;
 }
 
-
-#endif /* TARGET_IRIX6 */
+#endif /* TARGET_IRIX */
 
 #include "gt-mips.h"
index 23fe285..0ac04c5 100644 (file)
@@ -336,6 +336,11 @@ extern const struct mips_cpu_info *mips_tune_info;
 
 #define TARGET_NEWABI              (mips_abi == ABI_N32 || mips_abi == ABI_64)
 
+/* IRIX specific stuff.  */
+#define TARGET_IRIX       0
+#define TARGET_IRIX5      0
+#define TARGET_SGI_O32_AS  (TARGET_IRIX && mips_abi == ABI_32 && !TARGET_GAS)
+
 /* Define preprocessor macros for the -march and -mtune options.
    PREFIX is either _MIPS_ARCH or _MIPS_TUNE, INFO is the selected
    processor.  If INFO's canonical name is "foo", define PREFIX to
@@ -3276,7 +3281,6 @@ while (0)
 #define ASM_OUTPUT_EXTERNAL(STREAM,DECL,NAME) \
   mips_output_external(STREAM,DECL,NAME)
 
-
 /* This is how to declare a function name.  The actual work of
    emitting the label is moved to function_prologue, so that we can
    get the line number correctly emitted before the .ent directive,
@@ -3286,6 +3290,10 @@ while (0)
 #undef ASM_DECLARE_FUNCTION_NAME
 #define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL)
 
+#ifndef FUNCTION_NAME_ALREADY_DECLARED
+#define FUNCTION_NAME_ALREADY_DECLARED 0
+#endif
+
 /* 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.
index d403df4..d157b3a 100644 (file)
@@ -1,10 +1,9 @@
 # ??? If no mabi=X option given, but a mipsX option is, then should deal
 # with that.
-# ??? mabi=32 is deliberately left off the list because it doesn't work yet.
-MULTILIB_OPTIONS=mabi=n32/mabi=64
+MULTILIB_OPTIONS=mabi=32/mabi=n32/mabi=64
 MULTILIB_DIRNAMES=
 MULTILIB_MATCHES=
-MULTILIB_OSDIRNAMES=. mabi=64
+MULTILIB_OSDIRNAMES=mabi=32 . mabi=64
 
 LIBGCC = stmp-multilib
 INSTALL_LIBGCC = install-multilib