This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
V3 PATCH: IRIX configuration
- To: gcc-patches at gcc dot gnu dot org, libstdc++ at sources dot redhat dot com, Gabriel Dos Reis <gdr at codesourcery dot com>
- Subject: V3 PATCH: IRIX configuration
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Sun, 29 Oct 2000 13:05:07 -0800
- Organization: CodeSourcery, LLC
I've now got V3 working on IRIX.
(It wasn't easy, largely thanks to the fact that all debugging had to
be done at the assembly level. GDB doesn't work on IRIX, and dbx
crashes on the debugging output produced by G++, and I don't know why.
I got good at debugging stripped executables with the pre-stripped
assembly sitting close by.)
I'll put in the patches bit by bit, keeping each change as
self-contained as possible.
Here's the summary of patches to come:
- Configury stuff for IRIX in the config/os directory.
- G++ doesn't use thunks on IRIX, so we need to allow the OS
directory to override _G_config.h's _G_USING_THUNKS setting.
- IRIX doesn't support all the wide-character functionality
required, so we need to turn off lots of little bits of libio
and V3. This had been done historically, but looks to have
rotted, presumably due to having being used only on more
wide-character friendly systems.
BTW, the missing functionality here is wmemmove and friends.
It might be possible to provide replacements, but I decided
not to, partly so that we could figure out how to turn off
this stuff in the library. IRIX will not be the only target
without wide-character support.
- IRIX provides its own cabs, cabsf, and cabsl. Obviously,
these do not take a `__complex__ float', or whatever, as
arguments; they take a funny like IRIX-specific struct as
input. For example:
struct __cabsl_s { long double a,b; };
extern long double cabsl( struct __cabsl_s );
We get in trouble, since libmath tries to define these
same functions. Since the layout of these things is exactly
like `__complex__ double' it should work to use the IRIX
versions, so I made that work.
(Also, the implementation of `abs' for libstdc++ in
src/complex.cc looked odd to me; it was:
abs(const complex<FLT>& __x)
{ return cabs(__x._M_value); }
But, since there's only one cabs (which takes doubles), we'll end
up using double-precision even for `complex<float>' and
`complex<double>'. In my patch, I changed this, but I'd
appreciate commentary from Gaby, as numerics expert, and anyone
else who knows for sure.
(As a side-issue, using __complex__ in V3 is obviously non-potable
to compilers other than GCC, which is maybe or maybe not something
anyone cares about.)
Here's the first bit:
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
2000-10-29 Mark Mitchell <mark@codesourcery.com>
* acinclue.m4 (GLIBCPP_ENABLE_ATOMICITY): Handle IRIX.
* aclocal.m4: Regenerated.
* configure: Likewise.
* config/os/irix/bits/atomicity.h: New file.
* config/os/irix/bits/os_defines.h (_POSIX_SOURCE): Undefine.
(__off_t): Define.
(__off64_t): Likewise.
(__ssize_t): Likewise.
(_G_USING_THUNKS): Define to zero.
Index: acinclude.m4
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/acinclude.m4,v
retrieving revision 1.73
diff -c -p -r1.73 acinclude.m4
*** acinclude.m4 2000/10/27 12:29:41 1.73
--- acinclude.m4 2000/10/29 20:27:24
*************** AC_DEFUN(GLIBCPP_ENABLE_ATOMICITY, [
*** 1427,1432 ****
--- 1429,1437 ----
*-*-aix*)
ATOMICITYH=$os_include_dir
;;
+ *-*-irix*)
+ ATOMICITYH=$os_include_dir
+ ;;
*)
# bit of overkill on this text...
AC_MSG_ERROR([Atomic locking requested, but $enable_threads is an unknown thread package and atomic operations are not present in the CPU])
Index: config/os/irix/bits/atomicity.h
===================================================================
RCS file: atomicity.h
diff -N atomicity.h
*** /dev/null Tue May 5 13:32:27 1998
--- atomicity.h Sun Oct 29 12:27:29 2000
***************
*** 0 ****
--- 1,42 ----
+ /* Low-level functions for atomic operations. IRIX version.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+ #ifndef _BITS_ATOMICITY_H
+ #define _BITS_ATOMICITY_H 1
+
+ #include <mutex.h>
+
+ typedef unsigned long _Atomic_word;
+
+ static inline _Atomic_word
+ __attribute__ ((__unused__))
+ __exchange_and_add (_Atomic_word* __mem, int __val)
+ {
+ return test_then_add (__mem, __val);
+ }
+
+
+ static inline void
+ __attribute__ ((unused))
+ __atomic_add (_Atomic_word* __mem, int __val)
+ {
+ test_then_add (__mem, __val);
+ }
+
+ #endif /* atomicity.h */
Index: config/os/irix/bits/os_defines.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/config/os/irix/bits/os_defines.h,v
retrieving revision 1.3
diff -c -p -r1.3 os_defines.h
*** os_defines.h 2000/10/25 12:50:05 1.3
--- os_defines.h 2000/10/29 20:27:29
***************
*** 29,40 ****
#ifndef _GLIBCPP_OS_DEFINES
! # define _GLIBCPP_OS_DEFINES
-
/* System-specific #define, typedefs, corrections, etc, go here. This
file will come before all others. */
#endif
--- 29,56 ----
#ifndef _GLIBCPP_OS_DEFINES
! #define _GLIBCPP_OS_DEFINES
/* System-specific #define, typedefs, corrections, etc, go here. This
file will come before all others. */
+ /* We need large file support. There are two ways to turn it on:
+ by defining either _LARGEFILE64_SOURCE or _SGI_SOURCE. However,
+ it does not actually work to define only the former, as then
+ <sys/stat.h> is invalid: `st_blocks' is defined to be a macro,
+ but then used as a field name. So, we have to turn on
+ _SGI_SOURCE. That only works if _POSIX_SOURCE is turned off,
+ so we have to explicitly turn it off. (Some of the libio C files
+ explicitly try to turn it on.) _SGI_SOURCE is actually turned on
+ implicitly via the command-line. */
+ #undef _POSIX_SOURCE
+
+ #define __off_t off_t
+ #define __off64_t off64_t
+ #define __ssize_t ssize_t
+
+ /* GCC does not use thunks on IRIX. */
+ #define _G_USING_THUNKS 0
#endif