https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58142
--- Comment #4 from Iain Sandoe <iains at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #3) > I think it's still open because nobody has looked at it again recently, not > because of any conscious decision. > > I'm changing the component to libstdc++ as the runtime library is > responsible for the cleanup. > > Iain, what do you think? If comment 2 is right, then GCC 7.1 and later will > use __cxa_thread_atexit from libc and the destruction order will be correct. > I don't know when Darwin libc acquired that function, maybe it's in all > supported versions of Darwin but we just didn't use it until the PR 78968 > change. A quick look says that __cxa_thread_atexit exists in libc from Darwin13, macOS 10.9 / Mavericks onwards. So it's not present in the system mentioned in the OP and Comment #1. .. it will not be present in Darwin9 and 10 which I still build and test for, but it's present in all versions "supported" by the vendor. We have previously worked around such issues by having a version-specific CRT, but not sure if that's applicable in this case. NOTE 1: Darwin uses GCC's emulatedTLS, and I have some concerns that there might be C++ issues with initialisers (and, thus possibly DTORs) anyway (see 84497). NOTE 2: (I don't think it's relevant, but just for completeness) Darwin's linker doesn't support ctor/dtor priorities.