mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 06:34:57 +00:00
LibC+LibELF: Correctly call destructors on exit()
We currently don't call any DT_FINI_ARRAY functions, so change that. The call to `_fini` in `exit` is unnecessary, as we now call the function referenced by DT_FINI in `__call_fini_functions`.
This commit is contained in:
parent
dcff48356f
commit
0bff1f61b6
5 changed files with 58 additions and 9 deletions
|
@ -345,6 +345,8 @@ static T c_str_to_floating_point(char const* str, char** endptr)
|
|||
|
||||
extern "C" {
|
||||
|
||||
void (*__call_fini_functions)();
|
||||
|
||||
void exit(int status)
|
||||
{
|
||||
__cxa_finalize(nullptr);
|
||||
|
@ -352,8 +354,7 @@ void exit(int status)
|
|||
if (secure_getenv("LIBC_DUMP_MALLOC_STATS"))
|
||||
serenity_dump_malloc_stats();
|
||||
|
||||
extern void _fini();
|
||||
_fini();
|
||||
__call_fini_functions();
|
||||
fflush(nullptr);
|
||||
|
||||
#ifndef _DYNAMIC_LOADER
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue