This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: eh_globals.cc compilation errors with -threads under hpux 10.20
- To: dave at hiauly1 dot hia dot nrc dot ca (John David Anglin)
- Subject: Re: eh_globals.cc compilation errors with -threads under hpux 10.20
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- Date: Wed, 16 May 2001 16:07:27 -0400 (EDT)
- Cc: bkoz at taarna dot cygnus dot com, libstdc++ at gcc dot gnu dot org
> > /xxx/gnu/gcc-3.0/objdir/gcc/xgcc -B/xxx/gnu/gcc-3.0/objdir/gcc/ -nostdinc++ -L/xxx/gnu/gcc-3.0/objdir/hppa1.1-hp-hpux10.20/threads/libstdc++-v3/src -L/xxx/gnu/gcc-3.0/objdir/hppa1.1-hp-hpux10.20/threads/libstdc++-v3/src/.libs -B/usr/local/hppa1.1-hp-hpux10.20/bin/ -B/usr/local/hppa1.1-hp-hpux10.20/lib/ -isystem /usr/local/hppa1.1-hp-hpux10.20/include -threads -I../../../../../libstdc++-v3/../gcc -I../../../../../libstdc++-v3/../include -I../../../../../libstdc++-v3/include -I../../../../../libstdc++-v3/include/std -I../../../../../libstdc++-v3/include/c_std -I../include -I../../../../../libstdc++-v3/libsupc++ -g -O2 -threads -fno-implicit-templates -Wall -Wno-format -W -Wwrite-strings -Winline -fdiagnostics-show-location=once -g -c ../../../../../libstdc++-v3/libsupc++/eh_globals.cc -fPIC -DPIC -o eh_globals.o
> > ../../../../../libstdc++-v3/libsupc++/eh_globals.cc: In function
> > `__cxxabiv1::__cxa_eh_globals* __cxa_get_globals()':
> > ../../../../../libstdc++-v3/libsupc++/eh_globals.cc:102: `eh_threads_initialize'
> > undeclared (first use this function)
I have done some hacking trying to fix some of the problems that I have seen
related to the above.
1) Use threads-posix.h with DCE threads. This is experimental.
2) Define _PTHREAD to 1. gthr.h needs this.
3) eh_globals.cc: Add includes to load thread configuration and protos for
free/malloc. Remove offending code. I don't know enough about the eh
implementation to correct this in a better way.
The library builds with these changes using posix threads under i686 linux.
Test results with mkcheck are, well yucky. The deja stuff doesn't work :-(
Hope this helps.
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
2001-05-16 John David Anglin <dave@hiauly1.hia.nrc.ca>
* aclocal.m4: Use threads-posix.h with DCE threads.
* config/threads-posix.h (_PTHREAD): Define as 1.
* libsupc++/eh_globals.cc (__cxa_get_globals): Rework following eh
merge.
--- aclocal.m4.orig Mon May 14 15:48:35 2001
+++ aclocal.m4 Wed May 16 15:42:55 2001
@@ -1218,10 +1218,10 @@
no | none | single)
THREADH=threads-no.h
;;
- posix | pthreads)
+ dce | posix | pthreads)
THREADH=threads-posix.h
;;
- decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
+ decosf1 | irix | mach | os2 | solaris | win32 | vxworks)
AC_MSG_WARN(disabling unsupported thread package $target_thread_file)
THREADH=threads-no.h
;;
--- config/threads-posix.h.orig Fri Apr 21 16:33:29 2000
+++ config/threads-posix.h Wed May 16 13:42:42 2001
@@ -49,7 +49,7 @@
//
// Currently needed for stl/bits/stl_config.h
-# define _PTHREADS
+# define _PTHREADS 1
// Currently libio expects this macro
#define _IO_MTSAFE_IO
--- libsupc++/eh_globals.cc.orig Sun May 13 03:10:26 2001
+++ libsupc++/eh_globals.cc Wed May 16 15:52:04 2001
@@ -28,7 +28,9 @@
// the GNU General Public License.
+#include <bits/c++threads.h>
#include <exception>
+#include <cstdlib>
#include "unwind-cxx.h"
#include "gthr.h"
@@ -95,19 +97,14 @@
g = (__cxa_eh_globals *) __gthread_getspecific (globals_key);
if (! g)
{
- static __gthread_once_t once = __GTHREAD_ONCE_INIT;
-
- // Make sure use_thread_key got initialized. Some systems have
- // dummy thread routines in their libc that return a success.
- if (__gthread_once (&once, eh_threads_initialize) != 0
- || use_thread_key < 0)
+ // Make sure use_thread_key got initialized.
+ if (use_thread_key < 0)
{
use_thread_key = 0;
return &globals_static;
}
- if ((g = malloc (sizeof (__cxa_eh_globals))) == 0
- || __gthread_setspecific (eh_context_key, (void *) g) != 0)
+ if ((g = (__cxa_eh_globals *) malloc (sizeof (__cxa_eh_globals))) == 0)
std::terminate ();
g->caughtExceptions = 0;
g->uncaughtExceptions = 0;