C++ Runtime May 2026
static char instance_memory[sizeof(Logger)]; static uint8_t guard = 0; // 0 = uninitialized, 1 = initializing, 2 = done if (guard == 2) goto done; if (__cxa_guard_acquire(&guard)) new (instance_memory) Logger(); __cxa_guard_release(&guard); __cxa_atexit(destroyer, instance_memory, __dso_handle);
:
static Logger& getLogger() static Logger instance; // thread‑safe initialization return instance; c++ runtime
done: return instance_memory;
// Constructor function for global std::string _GLOBAL__sub_I_example.cpp: stp x29, x30, [sp, -32]! mov x0, :got:globalString bl _ZNSt7__cxx1112basic_string...C1E... // std::string::string(char const*) ldr x0, :got:__dso_handle adrp x1, :got:_ZNSt7__cxx1112basic_string...D1E... add x1, x1, :lo12:_ZNSt7__cxx1112...D1E... bl __cxa_atexit // register destructor for atexit ldp x29, x30, [sp], 32 ret // .init_array entry points to this function add x1, x1, :lo12:_ZNSt7__cxx1112
: The stack is unwound again. For each frame between the throw site and the catch frame, the personality routine calls destructors for local objects ( _UA_CLEANUP_PHASE ). Finally, control jumps to the catch block. Finally, control jumps to the catch block