[libcxx-commits] [PATCH] D65667: [libcxx] Early-initialize error_category singletons
Andus Yu via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Aug 2 11:18:20 PDT 2019
andusy created this revision.
andusy added reviewers: hubert.reinterpretcast, jasonliu, mclow.lists.
andusy added a project: libc++.
Herald added a reviewer: EricWF.
Herald added subscribers: ldionne, christof.
When a handle to an error_category singleton object is used during the termination phase of a program, the destruction of the error_category object may have occurred prior to execution of the current destructor or function registered with `atexit`, because the singleton object may have been constructed after the corresponding initialization or call to `atexit`. For example, the updated tests from this patch will fail if using a libc++ built using a compiler that updates the vtable of the object on destruction. This patch attempts to avoid the issue by triggering the construction of the singleton objects during the initialization of non-local objects of static storage duration from the library. This approach might not work on platforms where such initialization is delayed.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 5457 bytes
Desc: not available
More information about the libcxx-commits