This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: libstdc++ related boostrap failure
On Thu, Feb 20, 2003 at 09:20:51PM +0300, Vladimir Merzliakov wrote:
> >
> > Like so. Once somebody confirms that FreeBSD can build&test with this
> > patch, I can go back and commit the original genric atomicity.h patch,
> > as well as this one, to the 3.3 branch.
> >
> > 2003-02-20 Phil Edwards <pme at gcc dot gnu dot org>
> >
> > * config/linker-map.gnu: Also export locking symbols needed for the
> > generic atomicity.h case.
> >
> After update gcc sources from CVS (with this patch)
> gcc bootstrap without problems at FreeBSD 4.6.1
Okay, then. The following is what I'll be committing to 3.3. (Sanity check
on the linker-map.gnu change?)
Index: config/linker-map.gnu
===================================================================
RCS file: /home/pme/Repositories/GCC/gcc/libstdc++-v3/config/linker-map.gnu,v
retrieving revision 1.25.2.3
diff -u -3 -r1.25.2.3 linker-map.gnu
--- config/linker-map.gnu 23 Jan 2003 17:19:26 -0000 1.25.2.3
+++ config/linker-map.gnu 20 Feb 2003 18:31:52 -0000
@@ -252,6 +252,16 @@
GLIBCPP_3.2.2 {
+ global:
+
+ extern "C++"
+ {
+ # Needed only when generic cpu's atomicity.h is in use.
+ __gnu_cxx::_Atomic_add_mutex;
+ __gnu_cxx::_Atomic_add_mutex_once;
+ __gnu_cxx::__gthread_atomic_add_mutex_once
+ };
+
_ZNSt24__default_alloc_templateILb1ELi0EE12_S_force_newE;
} GLIBCPP_3.2.1;
Index: config/cpu/generic/atomicity.h
===================================================================
RCS file: /home/pme/Repositories/GCC/gcc/libstdc++-v3/config/cpu/generic/atomicity.h,v
retrieving revision 1.4
diff -u -3 -r1.4 atomicity.h
--- config/cpu/generic/atomicity.h 8 Nov 2002 19:24:41 -0000 1.4
+++ config/cpu/generic/atomicity.h 20 Feb 2003 18:29:23 -0000
@@ -1,6 +1,6 @@
// Low-level functions for atomic operations: Generic version -*- C++ -*-
-// Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -32,24 +32,35 @@
#include <bits/gthr.h>
+#define _GLIBCPP_NEED_GENERIC_MUTEX
+
typedef int _Atomic_word;
namespace __gnu_cxx
{
- __gthread_mutex_t _Atomic_add_mutex __attribute__ ((__weak__))
- = __GTHREAD_MUTEX_INIT;
+ extern __gthread_mutex_t _Atomic_add_mutex;
+
+#ifndef __GTHREAD_MUTEX_INIT
+ extern __gthread_once_t _Atomic_add_mutex_once;
+ extern void __gthread_atomic_add_mutex_once();
+#endif
}
static inline _Atomic_word
__attribute__ ((__unused__))
__exchange_and_add (volatile _Atomic_word* __mem, int __val)
{
- _Atomic_word __result;
+#ifndef __GTHREAD_MUTEX_INIT
+ __gthread_once (&__gnu_cxx::_Atomic_add_mutex_once,
+ __gnu_cxx::__gthread_atomic_add_mutex_once);
+#endif
+
+ _Atomic_word __result;
- __gthread_mutex_lock (&__gnu_cxx::_Atomic_add_mutex);
+ __gthread_mutex_lock (&__gnu_cxx::_Atomic_add_mutex);
- __result = *__mem;
- *__mem += __val;
+ __result = *__mem;
+ *__mem += __val;
__gthread_mutex_unlock (&__gnu_cxx::_Atomic_add_mutex);
return __result;
Index: src/misc-inst.cc
===================================================================
RCS file: /home/pme/Repositories/GCC/gcc/libstdc++-v3/src/misc-inst.cc,v
retrieving revision 1.20
diff -u -3 -r1.20 misc-inst.cc
--- src/misc-inst.cc 5 Nov 2002 19:17:37 -0000 1.20
+++ src/misc-inst.cc 20 Feb 2003 18:29:23 -0000
@@ -87,3 +87,21 @@
string*, __false_type);
#endif
} // namespace std
+
+#ifdef _GLIBCPP_NEED_GENERIC_MUTEX
+namespace __gnu_cxx
+{
+#ifdef __GTHREAD_MUTEX_INIT
+ __gthread_mutex_t _Atomic_add_mutex = __GTHREAD_MUTEX_INIT;
+#else
+ // generic atomicity.h without static initialization
+ __gthread_mutex_t _Atomic_add_mutex;
+ __gthread_once_t _Atomic_add_mutex_once = __GTHREAD_ONCE_INIT;
+ void __gthread_atomic_add_mutex_once()
+ {
+ __GTHREAD_MUTEX_INIT_FUNCTION (&_Atomic_add_mutex);
+ }
+#endif
+} // namespace __gnu_cxx
+#endif // _GLIBCPP_NEED_GLOBAL_MUTEX
+