This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
3.0 PATCH: Band-aid for IRIX 6 N32/N64 structure passing bug
- To: gcc-patches at gcc dot gnu dot org
- Subject: 3.0 PATCH: Band-aid for IRIX 6 N32/N64 structure passing bug
- From: Rainer Orth <ro at TechFak dot Uni-Bielefeld dot DE>
- Date: Fri, 8 Jun 2001 12:30:20 +0200 (MEST)
- Cc: David Kaelbling <drk at sgi dot com>, Andy Polyakov <appro at fy dot chalmers dot se>
While checking the IRIX section of current gcc/doc/install.texi (patches to
follow), I had a look at the version of gcc 2.95.2 from freeware.sgi.com.
http://freeware.sgi.com/shared/howto.html#b1
The sources distributed are identical to the FSF distribution, with the
addition of a single file to work around gcc's N32/N64 structure passing
bug in a couple of common cases.
In case I cannot come up with a correct and acceptable patch for the
underlying problem within the next week, I'd like to install the following
patch as a band-aid for 3.0 so gcc users don't have to get a gcc 3.0
distribution with this single addition from elsewhere to have a usable gcc
on IRIX 6.
I'm not sure what the copyright status of this file (sgi-hacks.c in the
freeware distribution, renamed to irix6-hacks.c here for clarity) is,
therefore I'm copying the creator of the freeware distribution and the
author of the file.
Bootstrapped on mips-sgi-irix6.2 with no regressions :-)
Rainer
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University
Email: ro@TechFak.Uni-Bielefeld.DE
Thu Jun 7 20:07:29 2001 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* config/mips/irix6-hacks.c: New file.
* config/mips/t-iris6 (LIB2FUNCS_STATIC_EXTRA): Use it.
Index: gcc/config/mips/irix6-hacks.c
===================================================================
RCS file: irix6-hacks.c
diff -N irix6-hacks.c
--- /dev/null Tue May 5 13:32:27 1998
+++ irix6-hacks.c Fri Jun 8 03:26:49 2001
@@ -0,0 +1,49 @@
+/* Time-stamp: "Mon 27 Nov 2000, 17:22:56 EST by drk@sgi.com (David Kaelbling)"
+ *
+ * Per Andy Polyakov <appro@fy.chalmers.se> in pv792701, this module
+ * is added to libgcc.a to try to hide known small structure padding
+ * differences between gcc and MipsPRO in libc.so. See the gcc
+ * release notes in /usr/freeware/relnotes/gcc.html for more details.
+ *
+ * This is not a general fix! It only help the more common problem
+ * routines.
+ */
+
+#ifdef __GNUC__
+
+#if _MIPS_SIM == _ABI64
+
+typedef unsigned long reg_t;
+#define REG_T
+
+#elif _MIPS_SIM == _ABIN32
+
+typedef unsigned long long reg_t;
+#define REG_T
+
+#endif /* _MIPS_SIM */
+
+#ifdef REG_T
+
+reg_t inet_ntoa (reg_t a0)
+{ return _inet_ntoa (a0<<32); }
+
+reg_t inet_lnaof (reg_t a0)
+{ return _inet_lnaof (a0<<32); }
+
+reg_t inet_netof (reg_t a0)
+{ return _inet_netof (a0<<32); }
+
+reg_t inet_makeaddr (reg_t a0, reg_t a1)
+{ reg_t _inet_makeaddr ();
+ return _inet_makeaddr (a0,a1)>>32;
+}
+
+#if _MIPS_SIM != _ABI64
+reg_t semctl (reg_t a0, reg_t a1, reg_t a2, reg_t a3)
+{ return _semctl(a0,a1,a2,a3<<32); }
+#endif /* _MIPS_SIM */
+
+#endif /* REG_T */
+
+#endif /* __GNUC__ */
Index: gcc/config/mips/t-iris6
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/t-iris6,v
retrieving revision 1.8
diff -u -p -r1.8 t-iris6
--- t-iris6 2001/01/07 21:55:10 1.8
+++ t-iris6 2001/06/08 10:26:51
@@ -53,3 +53,7 @@ fp-bit.c: $(srcdir)/config/fp-bit.c
echo '#define FLOAT' > fp-bit.c
echo '#undef US_SOFTWARE_GOFAST' >> fp-bit.c
cat $(srcdir)/config/fp-bit.c >> fp-bit.c
+
+# This is only needed in the static libgcc as a band-aid until gcc correctly
+# implements the N32/N64 ABI structure passing conventions
+LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/mips/irix6-hacks.c