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
+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
;;
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"
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
/* 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}}} \
%{!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 \
/* ??? 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}}\
%{!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
} 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 },
%{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"
--- /dev/null
+ .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
--- /dev/null
+ .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
--- /dev/null
+$(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