arduino/Arduino — pull request #107 by kibergus (2012-08-12 19:49:24+00:00)
Title: Correct implementation of gcc specific internal functions

This patch add correct implementation for:
int __cxa_guard_acquire(__guard *);
void __cxa_guard_release (__guard *);
void __cxa_guard_abort (__guard *);
void __cxa_pure_virtual(void) __attribute__ ((__noreturn__));
void __cxa_deleted_virtual(void) __attribute__ ((__noreturn__));

Current implementations in arduino are just stubs that can lead to undefined behavior if one of that functions is used. __cxa_guard_acquire, __cxa_guard_release and __cxa_guard_abort are needed for thread safe initialization of static variables (in case if they can't be initialized at compile time). If you don't need thread safety just turn it of with -fno-threadsafe-statics. Buf if you provide it, provide correct implementation, not a stub.

__cxa_pure_virtual and __cxa_deleted_virtual are called if thing went really wrong and they must not return. They must terminate the program because it is already broken.