* config.gcc (mips-sgi-irix6*): Add t-iris6gld to tmake_file when
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 24 Nov 2003 21:02:12 +0000 (21:02 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 24 Nov 2003 21:02:12 +0000 (21:02 +0000)
using GNU ld.
* config/mips/iris6.h (IRIX6_STARTFILE_SPEC): New, taking the
whole of the previous STARTFILE_SPEC except crtbegin.o%s.
(IRIX6_ENDFILE_SPEC): Likewise ENDFILE_SPEC and crtend.o%s.
(STARTFILE_SPEC, ENDFILE_SPEC): Define in terms of the above.
(SUBTARGET_EXTRA_SPECS): Define.
* config/mips/iris6gld.h (LINK_SPEC): Change -init function
to __gcc_init and -fini function to __gcc_fini.
(STARTFILE_SPEC): Redefine, including irix6-crti.o before crtbegin.o.
(ENDFILE_SPEC): Likewise, including irix6-crtn.o after crtend.o.
(INIT_SECTION_ASM_OP, FINI_SECTION_ASM_OP): Define.
* config/mips/t-iris6gld,
* config/mips/irix6-crti.asm,
* config/mips/irix6-crtn.asm: New files.

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

gcc/ChangeLog
gcc/config.gcc
gcc/config/mips/iris6.h
gcc/config/mips/iris6gld.h
gcc/config/mips/irix6-crti.asm [new file with mode: 0644]
gcc/config/mips/irix6-crtn.asm [new file with mode: 0644]
gcc/config/mips/t-iris6gld [new file with mode: 0644]

index fe2752e..f64a7e5 100644 (file)
@@ -1,3 +1,21 @@
+2003-11-24  Richard Sandiford  <rsandifo@redhat.com>
+
+       * config.gcc (mips-sgi-irix6*): Add t-iris6gld to tmake_file when
+       using GNU ld.
+       * config/mips/iris6.h (IRIX6_STARTFILE_SPEC): New, taking the
+       whole of the previous STARTFILE_SPEC except crtbegin.o%s.
+       (IRIX6_ENDFILE_SPEC): Likewise ENDFILE_SPEC and crtend.o%s.
+       (STARTFILE_SPEC, ENDFILE_SPEC): Define in terms of the above.
+       (SUBTARGET_EXTRA_SPECS): Define.
+       * config/mips/iris6gld.h (LINK_SPEC): Change -init function
+       to __gcc_init and -fini function to __gcc_fini.
+       (STARTFILE_SPEC): Redefine, including irix6-crti.o before crtbegin.o.
+       (ENDFILE_SPEC): Likewise, including irix6-crtn.o after crtend.o.
+       (INIT_SECTION_ASM_OP, FINI_SECTION_ASM_OP): Define.
+       * config/mips/t-iris6gld,
+       * config/mips/irix6-crti.asm,
+       * config/mips/irix6-crtn.asm: New files.
+
 2003-11-24  Eric Christopher  <echristo@redhat.com>
 
        PR C/13014
index 4ac9a79..ae9447d 100644 (file)
@@ -1418,6 +1418,7 @@ 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"
+       tmake_file="mips/t-iris mips/t-iris5-6 mips/t-iris6"
        if test x$gas = xyes
        then
                tm_file="${tm_file} mips/iris6gas.h"
@@ -1425,8 +1426,8 @@ mips-sgi-irix6*)          # SGI System V.4., IRIX 6
        if test "x$gnu_ld" = xyes
        then
                tm_file="${tm_file} mips/iris6gld.h"
+               tmake_file="$tmake_file mips/t-iris6gld"
        fi
-       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
index ca8f428..5bac6e6 100644 (file)
@@ -436,8 +436,7 @@ while (0)
 /* 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 \
+#define IRIX6_STARTFILE_SPEC \
   "%{!shared: \
      %{mabi=32:%{pg:gcrt1.o%s} \
        %{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}} \
@@ -461,8 +460,10 @@ while (0)
            %{!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"
+           %{!p:/usr/lib32/mips3/crt1.o%s}}}}}"
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "%(irix6_startfile_spec) crtbegin.o%s"
 
 #undef LIB_SPEC
 #define LIB_SPEC \
@@ -481,10 +482,8 @@ while (0)
 
 /* ??? If no mabi=X option give, but a mipsX option is, then should depend
    on the mipsX option.  */
-#undef ENDFILE_SPEC
-#define ENDFILE_SPEC \
-  "crtend.o%s \
-   %{!shared: \
+#define IRIX6_ENDFILE_SPEC \
+  "%{!shared: \
      %{mabi=32:crtn.o%s}\
      %{mabi=n32:%{mips4:/usr/lib32/mips4/crtn.o%s}\
        %{!mips4:/usr/lib32/mips3/crtn.o%s}}\
@@ -493,6 +492,9 @@ while (0)
      %{!mabi*:%{mips4:/usr/lib32/mips4/crtn.o%s}\
        %{!mips4:/usr/lib32/mips3/crtn.o%s}}}"
 
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC "crtend.o%s %(irix6_endfile_spec)"
+
 /* ??? If no mabi=X option give, but a mipsX option is, then should depend
    on the mipsX option.  */
 #undef LINK_SPEC
@@ -516,3 +518,8 @@ do {                                                                \
 } while (0)
 
 #define MIPS_TFMODE_FORMAT mips_extended_format
+
+#undef SUBTARGET_EXTRA_SPECS
+#define SUBTARGET_EXTRA_SPECS \
+  { "irix6_startfile_spec", IRIX6_STARTFILE_SPEC }, \
+  { "irix6_endfile_spec", IRIX6_ENDFILE_SPEC },
index 3ae5587..1e5ee2c 100644 (file)
@@ -44,8 +44,17 @@ Boston, MA 02111-1307, USA.  */
 %{static: -non_shared} \
 %{!static: \
   %{!shared: %{!non_shared: %{!call_shared: -call_shared}}}} \
-%{rpath} -init __do_global_ctors -fini __do_global_dtors \
+%{rpath} -init __gcc_init -fini __gcc_fini \
 %{mabi=32: -melf32bsmip}%{mabi=n32: -melf32bmipn32}%{mabi=64: -melf64bmip}%{!mabi*: -melf32bmipn32}"
 
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "%(irix6_startfile_spec) irix6-crti.o%s crtbegin.o%s"
+
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC "crtend.o%s irix6-crtn.o%s %(irix6_endfile_spec)"
+
 /* The GNU linker supports one-only sections.  */
 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
+
+#define INIT_SECTION_ASM_OP "\t.section\t.init,0x1,0x6,4,4"
+#define FINI_SECTION_ASM_OP "\t.section\t.fini,0x1,0x6,4,4"
diff --git a/gcc/config/mips/irix6-crti.asm b/gcc/config/mips/irix6-crti.asm
new file mode 100644 (file)
index 0000000..5d8ede7
--- /dev/null
@@ -0,0 +1,33 @@
+       .abicalls
+       .set    noreorder
+       .set    nomacro
+
+       .section .init,0x1,0x6,4,4
+       jr      $31
+       nop
+
+       .globl  __gcc_init
+__gcc_init:
+#if _MIPS_SIM == _ABIO32
+       addiu   $sp,$sp,-16
+       sw      $31,0($sp)
+#else
+       daddiu  $sp,$sp,-16
+       sd      $31,0($sp)
+       sd      $28,8($sp)
+#endif
+
+       .section .fini,0x1,0x6,4,4
+       jr      $31
+       nop
+
+       .globl  __gcc_fini
+__gcc_fini:
+#if _MIPS_SIM == _ABIO32
+       addiu   $sp,$sp,-16
+       sw      $31,0($sp)
+#else
+       daddiu  $sp,$sp,-16
+       sd      $31,0($sp)
+       sd      $28,8($sp)
+#endif
diff --git a/gcc/config/mips/irix6-crtn.asm b/gcc/config/mips/irix6-crtn.asm
new file mode 100644 (file)
index 0000000..647e8e1
--- /dev/null
@@ -0,0 +1,27 @@
+       .abicalls
+       .set    noreorder
+       .set    nomacro
+
+       .section .init,0x1,0x6,4,4
+#if _MIPS_SIM == _ABIO32
+       lw      $31,0($sp)
+       jr      $31
+       addiu   $sp,$sp,16
+#else
+       ld      $31,0($sp)
+       ld      $28,8($sp)
+       jr      $31
+       daddiu  $sp,$sp,16
+#endif
+
+       .section .fini,0x1,0x6,4,4
+#if _MIPS_SIM == _ABIO32
+       lw      $31,0($sp)
+       jr      $31
+       addiu   $sp,$sp,16
+#else
+       ld      $31,0($sp)
+       ld      $28,8($sp)
+       jr      $31
+       daddiu  $sp,$sp,16
+#endif
diff --git a/gcc/config/mips/t-iris6gld b/gcc/config/mips/t-iris6gld
new file mode 100644 (file)
index 0000000..2926be0
--- /dev/null
@@ -0,0 +1,9 @@
+$(T)irix6-crti.o: $(srcdir)/config/mips/irix6-crti.asm $(GCC_PASSES)
+       $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
+       -c -o $@ -x assembler-with-cpp $<
+
+$(T)irix6-crtn.o: $(srcdir)/config/mips/irix6-crtn.asm $(GCC_PASSES)
+       $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
+       -c -o $@ -x assembler-with-cpp $<
+
+EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o irix6-crti.o irix6-crtn.o