libc: tests: add some tests for __cxa_atexit handling
This adds a basic test that cxa_atexit works, and also adds some tests
for cxa_atexit handlers registered in the middle of __cxa_finalize.
PR: 285870
(cherry picked from commit ee9ce1078c596f5719f312feedd616ab0fb41dc9)