]> git.ipfire.org Git - thirdparty/gcc.git/commit - libstdc++-v3/config/abi/pre/gnu.ver
libstdc++: Only use std::atomic<tzdb_list::_Node*> if lock free [PR108228]
authorJonathan Wakely <jwakely@redhat.com>
Wed, 4 Jan 2023 16:45:14 +0000 (16:45 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 5 Jan 2023 00:46:00 +0000 (00:46 +0000)
commitb1ad748754401613b5cf8e5d46b38ad1ee49d07a
tree24be05aa3e7aee607b59f8c6479c51387813b6a9
parente36e57b032b2d70eaa1294d5921e4fd8ce12a74d
libstdc++: Only use std::atomic<tzdb_list::_Node*> if lock free [PR108228]

This fixes linker errors for hppa-hp-hpux11.11 due to an undefined weak
symbol and the use of atomic operations that require libatomic.

The weak symbol can simply be defined, which we already do for darwin.

The std::atomic<_Node*> is only an optimization, so can be avoided for
targets where the underlying atomic ops aren't available without help
from libatomic. The accesses to the std::atomic<_Node*> can be
abstracted behind a new API for getting and setting the cached value,
and then the atomics can be used conditionally.

libstdc++-v3/ChangeLog:

PR libstdc++/108228
PR libstdc++/108235
* config/abi/pre/gnu.ver: Move zoneinfo_dir_override export to
the latest symbol version.
* src/c++20/tzdb.cc (USE_ATOMIC_SHARED_PTR): Define to 0 if
atomic<_Node*> is not always lock free.
(USE_ATOMIC_LIST_HEAD): New macro.
[__hpux__] (__gnu_cxx::zoneinfo_dir_override()): Provide
definition of weak symbol.
(tzdb_list::_Node::_S_head): Rename to _S_head_cache.
(tzdb_list::_Node::_S_list_head): New function for accessing
list head efficiently.
(tzdb_list::_Node::_S_cache_list_head): New function for
updating _S_list_head.
libstdc++-v3/config/abi/pre/gnu.ver
libstdc++-v3/src/c++20/tzdb.cc