From 21b807f18020f6f10753b0a0ab7d53a65f31b79a Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 24 Nov 2003 21:02:12 +0000 Subject: [PATCH] config.gcc (mips-sgi-irix6*): Add t-iris6gld to tmake_file when using GNU ld. * 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. From-SVN: r73891 --- gcc/ChangeLog | 18 ++++++++++++++++++ gcc/config.gcc | 3 ++- gcc/config/mips/iris6.h | 23 +++++++++++++++-------- gcc/config/mips/iris6gld.h | 11 ++++++++++- gcc/config/mips/irix6-crti.asm | 33 +++++++++++++++++++++++++++++++++ gcc/config/mips/irix6-crtn.asm | 27 +++++++++++++++++++++++++++ gcc/config/mips/t-iris6gld | 9 +++++++++ 7 files changed, 114 insertions(+), 10 deletions(-) create mode 100644 gcc/config/mips/irix6-crti.asm create mode 100644 gcc/config/mips/irix6-crtn.asm create mode 100644 gcc/config/mips/t-iris6gld diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fe2752e692e8..f64a7e523172 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,21 @@ +2003-11-24 Richard Sandiford + + * 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 PR C/13014 diff --git a/gcc/config.gcc b/gcc/config.gcc index 4ac9a79f3dbe..ae9447db90e7 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -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 diff --git a/gcc/config/mips/iris6.h b/gcc/config/mips/iris6.h index ca8f4283b7c0..5bac6e6fd605 100644 --- a/gcc/config/mips/iris6.h +++ b/gcc/config/mips/iris6.h @@ -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 }, diff --git a/gcc/config/mips/iris6gld.h b/gcc/config/mips/iris6gld.h index 3ae5587c2faf..1e5ee2c9f967 100644 --- a/gcc/config/mips/iris6gld.h +++ b/gcc/config/mips/iris6gld.h @@ -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 index 000000000000..5d8ede703903 --- /dev/null +++ b/gcc/config/mips/irix6-crti.asm @@ -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 index 000000000000..647e8e13e317 --- /dev/null +++ b/gcc/config/mips/irix6-crtn.asm @@ -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 index 000000000000..2926be0cb44c --- /dev/null +++ b/gcc/config/mips/t-iris6gld @@ -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