https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58142
--- Comment #10 from Ev Drikos <drikosev at gmail dot com> --- (In reply to Jonathan Wakely from comment #9) > ... I'm not sure either. But I've confirmed in macOS (10.13) the following simple hack. If the routine that initialises the Emulated TLS created two keys and then deleted the first, immediately after, the former key would be reassigned to the one used in function "__cxa_thread_atexit". The destructors would run in the desired order. Ideally, this routine would like to know, if the following two symbols are defined: _GLIBCXX_HAVE___CXA_THREAD_ATEXIT, and _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL To avoid the hack then, one would need to know which "__cxa_thread_atexit" is used. Ev. Drikos