This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Status of GCC 3 on IRIX 5.3
- From: Rainer Orth <ro at TechFak dot Uni-Bielefeld dot DE>
- To: gcc at gcc dot gnu dot org
- Cc: Jason Andrade <jason at rtfmconsult dot com>
- Date: Wed, 30 Jul 2003 21:30:59 +0200 (MEST)
- Subject: Status of GCC 3 on IRIX 5.3
Prompted by PR target/10190 ([IRIX] building gcc 3.2.2 on irix 5.3 fails),
and enabled by Jason kindly providing access to an IRIX 5.3 system, I've
started investigating to revive the mips-sgi-irix5.3 support in GCC 3.
This is an overview of my current findings:
* Mainline currently fails to bootstrap (like mips-sgi-irix6.5o32) with the
native assembler, as reported in
http://gcc.gnu.org/ml/gcc-patches/2003-07/msg02748.html
* Trying with gas 2.14, I hit two problems:
The native IRIX 5 ld cannot handle .hidden, like the IRIX 6 O32 ld. I'll
submit a patch for this shortly.
Even after fixing this, libgcc_s.so.1 fails to link:
Assertion failed: 0, file obj_elf.c, line 353
This is obviously related to some feature of the gas-generated object
files, since (at least in the 3.2 branch) I've been able to build a
libgcc_s with the native ld. I'll contact SGI's Dave Anderson to see if
he can shed some light on this.
I'll try with GNU ld: although building it is disabled in current CVS
binutils, I managed to build libgcc_s.so from above object files
nonetheless. This requires a separate configuration (like iris6gld.h),
though, since GNU ld doesn't understand the -_SYSTYPE_SVR4 and
-hidden_symbol options).
* The 3.3 branch fails as well: during stage2, I get an ICE building
libgcc:
/server/source/build/gcc/gcc-3.3-branch/gcc/libgcc2.c: In function `__ashldi3':
/server/source/build/gcc/gcc-3.3-branch/gcc/libgcc2.c:296: internal compiler error: in mips_output_conditional_branch, at config/mips/mips.c:10390
* As a last resort, I tried the 3.2 branch, although it's already closed
(and doesn't a couple of the fixed I had added for IRIX 6 O32 support).
After configuring, I had to make a couple of changes to the generated
gcc/Makefile: I had to add -save-temps to BOOT_CFLAGS and remove -g from
all of BOOT_CFLAGS, CFLAGS, STAGE1_CFLAGS, and LIBGCC2_DEBUG_CFLAGS, for
the same reason as with the IRIX 6 O32 assembler: the assembler always
embeds temporary file names in its object files (fixed with -save-temps),
and, if invoked with -g, also embeds an ASCII timestamp (seconds since
the epoch) as well. There's no other fix for the latter.
I performed the actual bootstrap not with the vendor cc, but with gcc
2.95.3, built with similar gcc/Makefile changes.
After this change, I got mostly along with the bootstrap, with minor
exceptions:
** fastjar/jargrep.c failed to compile since IRIX 5.3 lacks regex.h. This
is already fixed on mainline.
** libobjc failed to compile since the compiler tried to use .8byte (which
the native assembler doesn't understand). Also fixed on mainline.
** Originally, no shared libgcc_s.so.1 was built. Simply copying the
relevant fragments from config/mips/t-iris6 to config/mips/t-iris fixed
this. Btw., this suggests that gas is to blame for generating dubious
object files, which the native ld cannot link.
Just for the reference, here are the patches used.
Index: fastjar/jargrep.c
===================================================================
RCS file: /cvs/gcc/gcc/fastjar/jargrep.c,v
retrieving revision 1.6
diff -u -p -r1.6 jargrep.c
--- fastjar/jargrep.c 9 Jan 2002 23:22:20 -0000 1.6
+++ fastjar/jargrep.c 30 Jul 2003 18:53:23 -0000
@@ -105,7 +105,6 @@ will test some other platforms later.
#include "config.h"
#include <stdio.h>
#include <unistd.h>
-#include <regex.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
@@ -115,6 +114,9 @@ will test some other platforms later.
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
+
+#include "xregex.h"
+
#include "jargrep.h"
#include "jartool.h"
#include "pushback.h"
Index: gcc/config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.176.2.6.2.2
diff -u -p -r1.176.2.6.2.2 mips.c
--- gcc/config/mips/mips.c 12 Feb 2003 15:25:49 -0000 1.176.2.6.2.2
+++ gcc/config/mips/mips.c 30 Jul 2003 18:53:33 -0000
@@ -469,6 +469,10 @@ enum reg_class mips_char_to_class[256] =
#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
Index: gcc/config/mips/t-iris
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/t-iris,v
retrieving revision 1.1
diff -u -p -r1.1 t-iris
--- gcc/config/mips/t-iris 15 Nov 2001 13:05:54 -0000 1.1
+++ gcc/config/mips/t-iris 30 Jul 2003 18:53:33 -0000
@@ -1,2 +1,33 @@
# Find all of the declarations from the header files
FIXPROTO_DEFINES= -D__EXTENSIONS__ -D_SGI_SOURCE -D_LANGUAGE_C_PLUS_PLUS
+
+# Build a shared libgcc library.
+SHLIB_EXT = .so
+SHLIB_SOLINK = @shlib_base_name@.so
+SHLIB_SONAME = @shlib_so_name@.so.1
+SHLIB_NAME = @shlib_dir@@shlib_so_name@.so.1
+SHLIB_MAP = @shlib_map_file@
+SHLIB_OBJS = @shlib_objs@
+SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@
+
+SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
+ -Wl,-soname,$(SHLIB_SONAME) \
+ -o $(SHLIB_NAME) @multilib_flags@ $(SHLIB_OBJS) -lc && \
+ rm -f $(SHLIB_SOLINK) && \
+ $(LN_S) $(SHLIB_NAME) $(SHLIB_SOLINK)
+# ??? Irix 6.5 seems to eat the option fine (if we somehow remove the
+# -hidden_symbol option, which is documented to be ignored in conjunction
+# with -exports_file), but fails to actually hide any symbols.
+# -Wl,-exports_file,$(SHLIB_MAP)
+
+# $(slibdir) double quoted to protect it from expansion while building
+# libgcc.mk. We want this delayed until actual install time.
+SHLIB_INSTALL = \
+ $$(SHELL) $$(srcdir)/mkinstalldirs $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL); \
+ $(INSTALL_DATA) $(SHLIB_NAME) \
+ $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SONAME); \
+ rm -f $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK); \
+ $(LN_S) $(SHLIB_SONAME) \
+ $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
+SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
+SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver
With those changes, 3.2 bootstrap finished and I could run the
testsuite. Currently, there are numerous failures, but many seem to be
for reasons already known from the IRIX 6 O32 configuration.
Once mainline bootstraps for me again, I'll try that and see what problems
remain there.
Rainer
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University