This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
3.4/3.5 PATCH: Support GNU ld on IRIX 5
- From: Rainer Orth <ro at TechFak dot Uni-Bielefeld dot DE>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 12 Feb 2004 22:24:30 +0100 (MET)
- Subject: 3.4/3.5 PATCH: Support GNU ld on IRIX 5
In order to be able to use GNU ld (tried with 2.14.90 from current CVS
binutils) on IRIX 5, I needed to apply this change as well:
http://gcc.gnu.org/ml/gcc-patches/2003-11/msg01948.html
This is largely a staightforward renaming to change irix6 to irix in
several places and moving a couple of definitions around to apply to both
IRIX 5 and 6, together with a new iris5gld.h file.
Bootstrapped on mainline for mips-sgi-irix5.3 with gas/gld and
mips-sgi-irix6.5 (with native tools, to make sure nothing broke there).
IRIX 5.3 results look quite reasonable:
http://gcc.gnu.org/ml/gcc-testresults/2004-02/msg00592.html
but I ran into a problem building libgnat:
../../xgcc -B../../ -c -g -O2 -W -Wall -gnatpg g-catiio.adb -o g-catiio.o
+===========================GNAT BUG DETECTED==============================+
| 3.5.0 20040209 (experimental) (mips-sgi-irix5.3) GCC error: |
| tree check: expected class 'd', have 'n' (à) in lookup_decl_loc, at |
| dwarf2out.c:5290 |
| Error detected at g-catiio.adb:485:25 |
This may be a known failure, though. I'll start investigating the few
remaining failures soon.
Ok for mainline now and 3.4 branch after successful bootstrap there?
Rainer
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University
Thu Feb 12 22:00:01 2004 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* config/mips/t-iris6gld: Renamed to ...
* config/mips/t-irix-gld: ... this.
* config.gcc (mips-sgi-irix6*): Reflect this
(mips-sgi-irix5*): Use it with GNU ld.
* config/mips/irix6-crti.asm, config/mips/irix6-crtn.asm: Renamed
to ...
* config/mips/irix-crti.asm, config/mips/irix-crtn.asm: ... this.
* config/mips/t-irix-gld: Reflect this.
* config/mips/iris6gld.h (STARTFILE_SPEC, ENDFILE_SPEC): Likewise.
* config/mips/iris5gld.h: New file.
* config.gcc (mips-sgi-irix5*): Use it with GNU ld.
Only use collect2 without gas.
* config/mips/iris6.h (IRIX6_STARTFILE_SPEC, IRIX6_ENDFILE_SPEC):
Renamed to IRIX_STARTFILE_SPEC, IRIX_ENDFILE_SPEC.
(STARTFILE_SPEC, ENDFILE_SPEC, SUBTARGET_EXTRA_SPECS): Reflect this.
* config/mips/iris6gld.h (STARTFILE_SPEC, ENDFILE_SPEC): Likewise.
* config/mips/iris6.h (SUBTARGET_EXTRA_SPECS): Moved ...
* config/mips/iris5.h: ... here.
* config/mips/iris5.h (STARTFILE_SPEC, ENDFILE_SPEC): Renamed to
IRIX_STARTFILE_SPEC, IRIX_ENDFILE_SPEC.
(STARTFILE_SPEC, ENDFILE_SPEC): Define.
* config/mips/iris5gas.h (STARTFILE_SPEC, ENDFILE_SPEC): Simplify
using irix_startfile_spec, irix_endfile_spec.
Index: gcc/config.gcc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config.gcc,v
retrieving revision 1.427
diff -u -p -r1.427 config.gcc
--- gcc/config.gcc 7 Feb 2004 17:06:18 -0000 1.427
+++ gcc/config.gcc 9 Feb 2004 21:04:48 -0000
@@ -1240,7 +1240,7 @@ mips-sgi-irix6*) # SGI System V.4., IRI
if test "x$gnu_ld" = xyes
then
tm_file="${tm_file} mips/iris6gld.h"
- tmake_file="$tmake_file mips/t-iris6gld"
+ tmake_file="$tmake_file mips/t-irix-gld"
fi
target_cpu_default="MASK_ABICALLS|MASK_FLOAT64|MASK_64BIT"
tm_defines="MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_N32"
@@ -1280,11 +1280,19 @@ mips-sgi-irix5*) # SGI System V.4., IRI
else
tmake_file=mips/t-iris5-as
fi
+ if test "x$gnu_ld" = xyes
+ then
+ tm_file="${tm_file} mips/iris5gld.h"
+ tmake_file="$tmake_file mips/t-irix-gld"
+ fi
tmake_file="${tmake_file} mips/t-iris mips/t-iris5-6"
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
Index: gcc/config/mips/iris5.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/iris5.h,v
retrieving revision 1.28
diff -u -p -r1.28 iris5.h
--- gcc/config/mips/iris5.h 9 Feb 2004 17:54:46 -0000 1.28
+++ gcc/config/mips/iris5.h 9 Feb 2004 21:04:57 -0000
@@ -135,8 +135,7 @@ Boston, MA 02111-1307, USA. */
-_SYSTYPE_SVR4"
/* We now support shared libraries. */
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "\
+#define IRIX_STARTFILE_SPEC "\
%{!static: \
%{!shared:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}}} \
%{static: \
@@ -144,11 +143,16 @@ Boston, MA 02111-1307, USA. */
%{!pg:%{p:/usr/lib/nonshared/mcrt1.o%s libprof1.a%s} \
%{!p:/usr/lib/nonshared/crt1.o%s}}}"
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "%(irix_startfile_spec)"
+
#undef LIB_SPEC
#define LIB_SPEC "%{!shared:%{p:-lprof1} %{pg:-lprof1} -lc}"
+#define IRIX_ENDFILE_SPEC "%{!shared:crtn.o%s}"
+
#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "%{!shared:crtn.o%s}"
+#define ENDFILE_SPEC "%(irix_endfile_spec)"
/* We do not want to run mips-tfile! */
#undef ASM_FINAL_SPEC
@@ -291,3 +295,8 @@ do { \
/* Handle #pragma weak and #pragma pack. */
#define HANDLE_SYSV_PRAGMA 1
+
+#undef SUBTARGET_EXTRA_SPECS
+#define SUBTARGET_EXTRA_SPECS \
+ { "irix_startfile_spec", IRIX_STARTFILE_SPEC }, \
+ { "irix_endfile_spec", IRIX_ENDFILE_SPEC },
Index: gcc/config/mips/iris5gas.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/iris5gas.h,v
retrieving revision 1.19
diff -u -p -r1.19 iris5gas.h
--- gcc/config/mips/iris5gas.h 9 Feb 2004 17:54:47 -0000 1.19
+++ gcc/config/mips/iris5gas.h 9 Feb 2004 21:04:58 -0000
@@ -43,17 +43,10 @@
/* Override iris5.h versions to include crtbegin.o and crtend.o. */
#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "\
-%{!static: \
- %{!shared:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}}} \
-%{static: \
- %{pg:gcrt1.o%s} \
- %{!pg:%{p:/usr/lib/nonshared/mcrt1.o%s libprof1.a%s} \
- %{!p:/usr/lib/nonshared/crt1.o%s}}} \
-crtbegin.o%s"
+#define STARTFILE_SPEC "%(irix_startfile_spec) crtbegin.o%s"
#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "crtend.o%s %{!shared:crtn.o%s}"
+#define ENDFILE_SPEC "crtend.o%s %(irix_endfile_spec)"
/* Irix 5 does not have some strange restrictions that Irix 3 had. */
#undef SET_FILE_NUMBER
Index: gcc/config/mips/iris5gld.h
===================================================================
RCS file: gcc/config/mips/iris5gld.h
diff -N gcc/config/mips/iris5gld.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gcc/config/mips/iris5gld.h 9 Feb 2004 21:04:58 -0000
@@ -0,0 +1,42 @@
+/* Definitions of target machine for GNU compiler. IRIX 5 with GNU ld.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+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. */
+
+#undef LINK_SPEC
+#define LINK_SPEC "\
+%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \
+%{bestGnum} %{shared} %{non_shared} \
+%{call_shared} %{no_archive} %{exact_version} \
+%{static: -non_shared} \
+%{!static: \
+ %{!shared: %{!non_shared: %{!call_shared: -call_shared}}}} \
+%{rpath} -init __gcc_init -fini __gcc_fini \
+-melf32bsmip"
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "%(irix_startfile_spec) irix-crti.o%s crtbegin.o%s"
+
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC "crtend.o%s irix-crtn.o%s %(irix_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"
Index: gcc/config/mips/iris6.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/iris6.h,v
retrieving revision 1.76
diff -u -p -r1.76 iris6.h
--- gcc/config/mips/iris6.h 9 Feb 2004 17:54:47 -0000 1.76
+++ gcc/config/mips/iris6.h 9 Feb 2004 21:04:58 -0000
@@ -394,7 +394,8 @@ 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. */
-#define IRIX6_STARTFILE_SPEC \
+#undef IRIX_STARTFILE_SPEC
+#define IRIX_STARTFILE_SPEC \
"%{!shared: \
%{mabi=32:%{pg:gcrt1.o%s} \
%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}} \
@@ -421,7 +422,7 @@ while (0)
%{!p:/usr/lib32/mips3/crt1.o%s}}}}}"
#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%(irix6_startfile_spec) crtbegin.o%s"
+#define STARTFILE_SPEC "%(irix_startfile_spec) crtbegin.o%s"
#undef LIB_SPEC
#define LIB_SPEC \
@@ -440,7 +441,8 @@ while (0)
/* ??? If no mabi=X option give, but a mipsX option is, then should depend
on the mipsX option. */
-#define IRIX6_ENDFILE_SPEC \
+#undef IRIX_ENDFILE_SPEC
+#define IRIX_ENDFILE_SPEC \
"%{!shared: \
%{mabi=32:crtn.o%s}\
%{mabi=n32:%{mips4:/usr/lib32/mips4/crtn.o%s}\
@@ -451,7 +453,7 @@ while (0)
%{!mips4:/usr/lib32/mips3/crtn.o%s}}}"
#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "crtend.o%s %(irix6_endfile_spec)"
+#define ENDFILE_SPEC "crtend.o%s %(irix_endfile_spec)"
/* ??? If no mabi=X option give, but a mipsX option is, then should depend
on the mipsX option. */
@@ -476,8 +478,3 @@ 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: gcc/config/mips/iris6gld.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/iris6gld.h,v
retrieving revision 1.13
diff -u -p -r1.13 iris6gld.h
--- gcc/config/mips/iris6gld.h 24 Nov 2003 21:02:12 -0000 1.13
+++ gcc/config/mips/iris6gld.h 9 Feb 2004 21:04:58 -0000
@@ -48,10 +48,10 @@ Boston, MA 02111-1307, USA. */
%{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"
+#define STARTFILE_SPEC "%(irix_startfile_spec) irix-crti.o%s crtbegin.o%s"
#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "crtend.o%s irix6-crtn.o%s %(irix6_endfile_spec)"
+#define ENDFILE_SPEC "crtend.o%s irix-crtn.o%s %(irix_endfile_spec)"
/* The GNU linker supports one-only sections. */
#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
Index: gcc/config/mips/irix-crti.asm
===================================================================
RCS file: gcc/config/mips/irix-crti.asm
diff -N gcc/config/mips/irix-crti.asm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gcc/config/mips/irix-crti.asm 9 Feb 2004 21:04:58 -0000
@@ -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
Index: gcc/config/mips/irix-crtn.asm
===================================================================
RCS file: gcc/config/mips/irix-crtn.asm
diff -N gcc/config/mips/irix-crtn.asm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gcc/config/mips/irix-crtn.asm 9 Feb 2004 21:04:58 -0000
@@ -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
Index: gcc/config/mips/irix6-crti.asm
===================================================================
RCS file: gcc/config/mips/irix6-crti.asm
diff -N gcc/config/mips/irix6-crti.asm
--- gcc/config/mips/irix6-crti.asm 24 Nov 2003 21:02:12 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,33 +0,0 @@
- .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
Index: gcc/config/mips/irix6-crtn.asm
===================================================================
RCS file: gcc/config/mips/irix6-crtn.asm
diff -N gcc/config/mips/irix6-crtn.asm
--- gcc/config/mips/irix6-crtn.asm 24 Nov 2003 21:02:12 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,27 +0,0 @@
- .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
Index: gcc/config/mips/t-iris6gld
===================================================================
RCS file: gcc/config/mips/t-iris6gld
diff -N gcc/config/mips/t-iris6gld
--- gcc/config/mips/t-iris6gld 24 Nov 2003 21:02:12 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,9 +0,0 @@
-$(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
Index: gcc/config/mips/t-irix-gld
===================================================================
RCS file: gcc/config/mips/t-irix-gld
diff -N gcc/config/mips/t-irix-gld
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gcc/config/mips/t-irix-gld 9 Feb 2004 21:04:58 -0000
@@ -0,0 +1,9 @@
+$(T)irix-crti.o: $(srcdir)/config/mips/irix-crti.asm $(GCC_PASSES)
+ $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
+ -c -o $@ -x assembler-with-cpp $<
+
+$(T)irix-crtn.o: $(srcdir)/config/mips/irix-crtn.asm $(GCC_PASSES)
+ $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
+ -c -o $@ -x assembler-with-cpp $<
+
+EXTRA_MULTILIB_PARTS += irix-crti.o irix-crtn.o