[libc-commits] [PATCH] D131219: [libc] Add __cxa_atexit support to the atexit function.
Alex Brachet via Phabricator via libc-commits
libc-commits at lists.llvm.org
Mon Aug 8 08:09:39 PDT 2022
abrachet accepted this revision.
abrachet added inline comments.
This revision is now accepted and ready to land.
================
Comment at: libc/loader/linux/x86_64/start.cpp:120
size_t fini_array_size = __fini_array_end - __fini_array_start;
- for (size_t i = 0; i < fini_array_size; ++i)
- reinterpret_cast<FiniCallback *>(__fini_array_start[i])();
+ for (size_t i = fini_array_size; i > 0; --i)
+ reinterpret_cast<FiniCallback *>(__fini_array_start[i - 1])();
----------------
I think this was sent out for review before the D131133, so just a reminder to change the aarch64 code to behave this way too
================
Comment at: libc/src/stdlib/atexit.cpp:80
+extern "C" int __cxa_atexit(AtExitCallback *callback, void *payload, void *) {
+ return add_atexit_unit({callback, payload});
----------------
Might be worth adding a TODO here that eventually this will need to address the dso_handle argument.
================
Comment at: libc/test/integration/loader/linux/init_fini_array_test.cpp:26
// TODO: When we have implementation for __cxa_atexit, an explicit definition
// of the destructor should be provided to test that path of registering the
----------------
We can remove this TODO now
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131219/new/
https://reviews.llvm.org/D131219
More information about the libc-commits
mailing list