[committed] Fix problems on PA arising from atomicity changes

John David Anglin dave@hiauly1.hia.nrc.ca
Sun Feb 29 02:55:00 GMT 2004


This patch fixes two problems that were noticed following the recent
atomicity changes.

The first argument of __atomic_add needs to be volatile to make it
agree with the generic prototype in bits/atomicity.h.  This fixes
the link failure reported on hppa-linux.

It was also noticed that we were explicity instantiating the atomic
lock in all cases, even when GCC had weak support.  This was because
of a header ordering issue and a typo in os_defines.h.  We now use
__GXX_WEAK__ to avoid the ordering problem.

Tested on hppa2.0w-hp-hpux11.11, hppa64-hp-hpux11.11 and hppa-unknown-linux-gnu.
Installed to 3.5.  Need to look at 3.3 and 3.4.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2004-02-28  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>

	* config/cpu/hppa/atomicity.h (__atomic_add): Make first argument
	volatile.
	* config/os/hpux/os_defines.h (_GLIBCXX_INST_ATOMICITY_LOCK): Use
	__GXX_WEAK__ instead of _GLIBCXX_SUPPORTS_WEAK.

Index: config/cpu/hppa/atomicity.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/cpu/hppa/atomicity.h,v
retrieving revision 1.7
diff -u -3 -p -r1.7 atomicity.h
--- config/cpu/hppa/atomicity.h	27 Feb 2004 20:56:44 -0000	1.7
+++ config/cpu/hppa/atomicity.h	28 Feb 2004 03:19:36 -0000
@@ -76,7 +76,7 @@ namespace __gnu_cxx
   
   void
   __attribute__ ((__unused__))
-  __atomic_add(_Atomic_word* __mem, int __val)
+  __atomic_add(volatile _Atomic_word* __mem, int __val)
   {
     int tmp;
     volatile int& lock = _Atomicity_lock<0>::_S_atomicity_lock;
Index: config/os/hpux/os_defines.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/os/hpux/os_defines.h,v
retrieving revision 1.9
diff -u -3 -p -r1.9 os_defines.h
--- config/os/hpux/os_defines.h	26 Aug 2003 06:54:15 -0000	1.9
+++ config/os/hpux/os_defines.h	28 Feb 2004 03:19:36 -0000
@@ -1,6 +1,6 @@
 // Specific definitions for HPUX  -*- C++ -*-
 
-// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2002, 2004 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
@@ -93,7 +93,7 @@ typedef long int __padding_type;
 
 /* We need explicit instantiation of the atomicity lock on HPPA if
    there is no weak support.  */
-#if !defined(_GLIBCXX_SUPPORTS_WEAK) && defined (__hppa__)
+#if !__GXX_WEAK__ && defined (__hppa__)
 #define _GLIBCXX_INST_ATOMICITY_LOCK 1
 #endif
 



More information about the Gcc-patches mailing list