https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108228
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:b1ad748754401613b5cf8e5d46b38ad1ee49d07a commit r13-5003-gb1ad748754401613b5cf8e5d46b38ad1ee49d07a Author: Jonathan Wakely <jwak...@redhat.com> Date: Wed Jan 4 16:45:14 2023 +0000 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.