This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
3.4 PATCH: Fix minor IRIX 5 problems
- From: Rainer Orth <ro at TechFak dot Uni-Bielefeld dot DE>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 16 Sep 2003 23:01:43 +0200 (MEST)
- Subject: 3.4 PATCH: Fix minor IRIX 5 problems
Investigating PR target/10190 (which is about bootstrap failure on
mips-sgi-irix5.3), I initially ran into a couple of problems reported in
http://gcc.gnu.org/ml/gcc/2003-07/msg02249.html
Once the mainline bootstrap mentioned there was fixed, I only needed a few
minor changes to get the port to bootstrap again (with native cc and as):
* A hack to remove %{g*} from gcc.c (cpp_options). This works around PR
bootstrap/12173 until it is fixed for real.
* Like IRIX 6, the IRIX 5.3 cc defines _LONGLONG, and the definition is
needed, otherwise bootstrap fails compiling read-rtl.c:
gcc/read-rtl.c: In function `read_rtx':
gcc/read-rtl.c:718: warning: implicit declaration of function `atoll'
Since the iris5.h and iris6-o32.h variants are identical now, the latter
can be removed.
* Also, _ABIO32 is predefined and used to define _MIPS_SIM.
* Originally, I got many testsuite failures due to as warnings:
FAIL: gcc.c-torture/compile/20000105-1.c (test for excess errors)
Excess errors:
as1: Warning: /var/tmp//ccZJ1ug8.s, line 1: Binasm file dictates -pic: 2
uld:
No ucode object file linked -- please use -O2 or lower.
The workaround from iris6-o32-as.h applies here as well.
With these changes, mainline bootstrap completed, the test results are
here:
http://gcc.gnu.org/ml/gcc-testresults/2003-09/msg00590.html
I had to make some changes to dejagnu's target.exp to ignore some linker
etc. warnings. I'll submit those changes separately.
The results aren't too good, but a large number of failures fall into two
categories:
* As reported in PR target/7297, many EH testcases fail with sjlj
exceptions. Unfortunately, nobody has looked into this yet.
* The fortran failures seem to be due to a bug in the native as:
/usr/bin/../lib/ld:
assertion failed: word < (MAX_GOT_SIZE/4) at dynutil.c line 885
collect2: ld returned 1 exit status
This may be related to a similar bug in the IRIX 6 o32 as:
ld: FATAL 2 : Internal: at ../../ld/multigot.c lgot_local_got_offset() seg_ndx exceeds per_seg_lgot_table
ld: INFO 152: Output file removed because of error.
I've reported the latter to SGI, but have received no resolution yet.
For the mips-sgi-irix6o32 configuration, the problem vanishes with gas,
so it may be possible to work around the problem in g77, one it is
understood what the errors mean.
Given this, the results don't look too bad, either :-)
I'm now investigating what it takes to bootstrap with GNU as/ld: GNU as
alone doesn't work, and GNU ld use was originally hampered by a stupid
error of mine. More to come once I'm done.
Bootstrapped on mips-sgi-irix5.3 and mips-sgi-irix6.5o32 with native cc/as.
Ok for mainline?
Rainer
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University
Tue Sep 16 22:42:44 2003 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* config/mips/iris5.h (TARGET_OS_CPP_BUILTINS): Define _LONGLONG.
Define _ABIO32.
Use it for _MIPS_SIM.
* config/mips/iris6-o32.h (TARGET_OS_CPP_BUILTINS): Removed.
* config/mips/iris6-o32-as.h (SUBTARGET_ASM_OPTIMIZING_SPEC):
Moved ...
* config/mips/iris5.h (SUBTARGET_ASM_OPTIMIZING_SPEC): ... here,
updating comment.
Fixes PR target/10190.
Index: gcc/config/mips/iris5.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/iris5.h,v
retrieving revision 1.20
diff -u -p -r1.20 iris5.h
--- gcc/config/mips/iris5.h 14 Jul 2003 20:12:07 -0000 1.20
+++ gcc/config/mips/iris5.h 16 Sep 2003 14:07:02 -0000
@@ -56,16 +56,23 @@ Boston, MA 02111-1307, USA. */
(DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
|| !strcmp (STR, "rpath"))
+/* We must pass -D_LONGLONG always, even when -ansi is used, because IRIX 5
+ system header files require it. This is OK, because gcc never warns
+ when long long is used in system header files. Alternatively, we can
+ add support for the SGI builtin type __long_long. */
+
#define TARGET_OS_CPP_BUILTINS() \
do { \
builtin_define_std ("host_mips"); \
builtin_define_std ("sgi"); \
builtin_define_std ("unix"); \
builtin_define_std ("SYSTYPE_SVR4"); \
+ builtin_define ("_LONGLONG"); \
builtin_define ("_MODERN_C"); \
builtin_define ("_SVR4_SOURCE"); \
builtin_define ("__DSO__"); \
- builtin_define ("_MIPS_SIM=_MIPS_SIM_ABI32"); \
+ builtin_define ("_ABIO32=1"); \
+ builtin_define ("_MIPS_SIM=_ABIO32"); \
builtin_define ("_MIPS_SZPTR=32"); \
builtin_assert ("system=unix"); \
builtin_assert ("system=svr4"); \
@@ -95,6 +102,18 @@ Boston, MA 02111-1307, USA. */
#undef SUBTARGET_CC1_SPEC
#define SUBTARGET_CC1_SPEC "%{static: -mno-abicalls}"
+
+/* Override mips.h default: the IRIX 5 assembler warns about -O3:
+
+ as1: Warning: <file>.s, line 1: Binasm file dictates -pic: 2
+ uld:
+ No ucode object file linked -- please use -O2 or lower.
+
+ So avoid passing it in the first place. */
+#undef SUBTARGET_ASM_OPTIMIZING_SPEC
+#define SUBTARGET_ASM_OPTIMIZING_SPEC "\
+%{noasmopt:-O0} \
+%{!noasmopt:%{O|O1|O2|O3:-O2}}"
#undef LINK_SPEC
#define LINK_SPEC "\
Index: gcc/config/mips/iris6-o32-as.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/iris6-o32-as.h,v
retrieving revision 1.2
diff -u -p -r1.2 iris6-o32-as.h
--- gcc/config/mips/iris6-o32-as.h 19 Jul 2002 21:58:12 -0000 1.2
+++ gcc/config/mips/iris6-o32-as.h 16 Sep 2003 14:07:02 -0000
@@ -1,17 +1,6 @@
/* Definitions of target machine for GNU compiler, for MIPS running IRIX 6
(O32 ABI) using the SGI assembler. */
-/* Override mips.h default: the IRIX 6 O32 assembler warns about -O3:
-
- as: Warning: -O3 is not supported for assembly compiles for ucode
- compilers; changing to -O2.
-
- So avoid passing it in the first place. */
-#undef SUBTARGET_ASM_OPTIMIZING_SPEC
-#define SUBTARGET_ASM_OPTIMIZING_SPEC "\
-%{noasmopt:-O0} \
-%{!noasmopt:%{O|O1|O2|O3:-O2}}"
-
/* Enforce use of O32 linker, irrespective of SGI_ABI environment variable
and machine type (e.g., R8000 systems default to -64). Copied from
iris5.h, only adding -32. The default options -call_shared -no_unresolved
Index: gcc/config/mips/iris6-o32.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/iris6-o32.h,v
retrieving revision 1.3
diff -u -p -r1.3 iris6-o32.h
--- gcc/config/mips/iris6-o32.h 17 Jun 2003 20:49:22 -0000 1.3
+++ gcc/config/mips/iris6-o32.h 16 Sep 2003 14:07:02 -0000
@@ -18,48 +18,6 @@
#undef WINT_TYPE_SIZE
#define WINT_TYPE_SIZE 32
-/* Copied from iris5.h, with _MIPS_SIM definition adapted to SGI cc usage
- and -D_LONGLONG added as in iris6.h. */
-#undef TARGET_OS_CPP_BUILTINS
-#define TARGET_OS_CPP_BUILTINS() \
- do { \
- builtin_define_std ("host_mips"); \
- builtin_define_std ("sgi"); \
- builtin_define_std ("unix"); \
- builtin_define_std ("SYSTYPE_SVR4"); \
- builtin_define ("_LONGLONG"); \
- builtin_define ("_MODERN_C"); \
- builtin_define ("_SVR4_SOURCE"); \
- builtin_define ("__DSO__"); \
- builtin_define ("_ABIO32=1"); \
- builtin_define ("_MIPS_SIM=_ABIO32"); \
- builtin_define ("_MIPS_SZPTR=32"); \
- builtin_assert ("system=unix"); \
- builtin_assert ("system=svr4"); \
- builtin_assert ("machine=sgi"); \
- \
- if (!TARGET_FLOAT64) \
- builtin_define ("_MIPS_FPSET=16"); \
- else \
- builtin_define ("_MIPS_FPSET=32"); \
- \
- if (!TARGET_INT64) \
- builtin_define ("_MIPS_SZINT=32"); \
- else \
- builtin_define ("_MIPS_SZINT=64"); \
- \
- if (!TARGET_LONG64) \
- builtin_define ("_MIPS_SZLONG=32"); \
- else \
- builtin_define ("_MIPS_SZLONG=64"); \
- \
- if (!flag_iso) \
- { \
- builtin_define ("__EXTENSIONS__"); \
- builtin_define ("_SGI_SOURCE"); \
- } \
-} while (0);
-
/* Enforce use of O32 assembler, irrespective of SGI_ABI environment variable
and machine type (e.g., R8000 systems default to -64). Gas doesn't need
this, but doesn't hurt either. Need to pass -mips2 to gas which defaults