This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/14311] New: builtins for atomic operations needed


See:
http://gcc.gnu.org/ml/libstdc++/2004-02/msg00372.html

Currently, the atomicity.h functions are used by:

%grep "atomicity.h" include/*/*.h | grep include
include/bits/basic_string.h:#include <bits/atomicity.h>
include/bits/ios_base.h:#include <bits/atomicity.h>
include/bits/locale_classes.h:#include <bits/atomicity.h>
include/ext/mt_allocator.h:#include <bits/atomicity.h>
include/ext/pool_allocator.h:#include <bits/atomicity.h>

This includes reference counting in std::string, std::ios_base
callbacks, std::locale::facet and std::locale::_Impl, and in various
allocator classes.

Although considered useful, this implementation has one drawback: on one
popular platform, (x86/linux), switching between atomicity files for
i386 and i486 and above is not compatible. Thus, when using i486 and
above libstdc++, all C++ applications (and thus C++ packages in an os
distribution) have to be compiled for both i386 and i486+. I believe
this has been an issue for Red Hat, Debian, and perhaps BSD.

One way around this would be to make these atomic functions gcc
builtins. These would be different semantics than other gcc builtins,
however, because there could be no fall back to a support library in the
case of failure to use the builtin.

Another would be to not define these functions in headers, and instead
put them into libstdc++.so, version them, and then export them. See the
attached patch, which was discussed in last week's tools conference
call. With this, linux distributions for i386 could use

-- 
           Summary: builtins for atomic operations needed
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bkoz at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14311


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]