lib: cpp: Do not define __cxa_atexit() for the posix arch

For the POSIX architecture we do not define an
empty __cxa_atexit() as it otherwise would
override its host libC counterpart. And this would
both disable the atexit() hooks, and prevent possible
test code global destructors from being registered.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2023-05-12 13:39:22 +02:00 committed by Anas Nashif
parent c4025f026f
commit b0668cc586

View file

@ -14,6 +14,13 @@
__weak void *__dso_handle;
#if !defined(CONFIG_ARCH_POSIX)
/*
* For the POSIX architecture we do not define an empty __cxa_atexit() as it otherwise
* would override its host libC counterpart. And this would both disable the atexit()
* hooks, and prevent possible test code global destructors from being registered.
*/
/**
* @brief Register destructor for a global object
*
@ -33,3 +40,4 @@ int __cxa_atexit(void (*destructor)(void *), void *objptr, void *dso)
ARG_UNUSED(dso);
return 0;
}
#endif