]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Fix lifetime bugs for non-TLS eh_globals [PR105880]
authorJonathan Wakely <jwakely@redhat.com>
Wed, 8 Jun 2022 09:43:57 +0000 (10:43 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 10 Jun 2022 14:24:29 +0000 (15:24 +0100)
commit1e65f2ed99024f23c56f7b6a961898bcaa882a92
treeee64eadb60c3441470c37a5a750ec11f1467ea0b
parent1753a7120109c1d3b682f9487d6cca64fb2f0929
libstdc++: Fix lifetime bugs for non-TLS eh_globals [PR105880]

This ensures that the single-threaded fallback buffer eh_globals is not
destroyed during program termination, using the same immortalization
technique used for error category objects.

Also ensure that init._M_init can still be read after init has been
destroyed, by making it a static data member.

libstdc++-v3/ChangeLog:

PR libstdc++/105880
* libsupc++/eh_globals.cc (eh_globals): Ensure constant init and
prevent destruction during termination.
(__eh_globals_init::_M_init): Replace with static member _S_init.
(__cxxabiv1::__cxa_get_globals_fast): Update.
(__cxxabiv1::__cxa_get_globals): Likewise.
libstdc++-v3/libsupc++/eh_globals.cc