summaryrefslogtreecommitdiff
path: root/libc/src/stdlib/atexit.cpp
AgeCommit message (Collapse)Author
2024-09-11[libc] fix tls teardown while being used (#108229)Schrodinger ZHU Yifan
The call chain to `Mutex:lock` can be polluted by stack protector. For completely safe, let's postpone the main TLS tearing down to a separate phase. fix #108030
2024-07-22[libc] Fix callback type in `exit_handlers.cpp` not matching (#97642)Joseph Huber
Summary: This file is an object library, but uses the `LIBC_COPT_PUBLIC_PACKAING` option. This will always be undefined which leads to a type mismatch when uses actually try to link against it. This patch simply removes this and turns it into a header only library. This means that the implementations of the callback lists and the mutexes need to live in their respective files. The result is that `atexit` needs to be defined for `at_quick_exit` to be valid.
2024-07-12[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98597)Petr Hosek
This is a part of #97655.
2024-07-12Revert "[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace ↵Mehdi Amini
declaration" (#98593) Reverts llvm/llvm-project#98075 bots are broken
2024-07-11[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98075)Petr Hosek
This is a part of #97655.
2024-06-06[libc] at_quick_exit function implemented (#94317)aaryanshukla
- added at_quick_exit function - used helper file exit_handler which reuses code from atexit - atexit now calls helper functions from exit_handler - test cases and dependencies are added --------- Co-authored-by: Aaryan Shukla <aaryanshukla@google.com>
2024-05-31[libc] rework mutex (#92168)Schrodinger ZHU Yifan
2024-05-09[libc] Replace `MutexLock` with `cpp::lock_guard` (#89340)Vlad Mishel
This PR address issue #89002. #### Changes in this PR * Added a simple implementation of `cpp::lock_guard` (an equivalent of `std::lock_guard`) in libc/src/__support/CPP inspired by the libstdc++ implementation * Added tests for `cpp::lock_guard` in /libc/test/src/__support/CPP/mutex_test.cpp * Replaced all references to `MutexLock` with `cpp::lock_guard` --------- Co-authored-by: Guillaume Chatelet <gchatelet@google.com>
2024-03-22[libc][stdlib] initial support for __cxa_finalize (#85865)Nick Desaulniers
I'm trying to break up the pieces of supporting __cxa_finalize into smaller commits. Provide this symbol first, and make use of it from exit. Next will be to store __dso_handle, then finally to only run callbacks that were registered from a specific dso. Link: #85651 Link: https://itanium-cxx-abi.github.io/cxx-abi/abi.html#dso-dtor
2024-03-15[libc] remove BlockStore from cpp namespace (#85312)Nick Desaulniers
The cpp namespace should only be used to mirror APIs from C++'s std:: namespace (at least until we share more code with libc++, see https://discourse.llvm.org/t/rfc-project-hand-in-hand-llvm-libc-libc-code-sharing/77701)
2024-02-23[libc] Remove use of BlockStore for GPU atexit (#82823)Joseph Huber
Summary: The GPU backends have restrictions on the kinds of initializers they can produce. The use of BlockStore here currently breaks the backends through the use of recursive initializers. This prevents it from actually being included in any builds. This patchs changes it to just use a fixed size of 64 slots .The chances of someone exceeding the 64 slots in practice is very, very low. However, this is primarily a bandaid solution as a real solution will need to use a lock free data structure to push work in parallel. Currently the mutexes on the GPU build do nothing, so they only work if the user guards the use themselves.
2023-09-26[libc] Mass replace enclosing namespace (#67032)Guillaume Chatelet
This is step 4 of https://discourse.llvm.org/t/rfc-customizable-namespace-to-allow-testing-the-libc-when-the-system-libc-is-also-llvms-libc/73079
2023-02-15[libc][NFC] Make tuning macros start with LIBC_COPT_Guillaume Chatelet
Rename preprocessor definitions that control tuning of llvm libc. Differential Revision: https://reviews.llvm.org/D143913
2022-12-21[libc] Gracefully handle allocation failures around BlockStore.Siva Chandra Reddy
Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D140459
2022-08-19[libc][NFC] Move blockstore out of the CPP folderGuillaume Chatelet
2022-08-09[libc] Add __cxa_atexit support to the atexit function.Siva Chandra Reddy
Reviewed By: abrachet Differential Revision: https://reviews.llvm.org/D131219
2022-03-16[libc] Unlock after pop_backAlex Brachet
2022-03-15[libc] Fix exit not calling new handlers registered from a call to atexit in ↵Alex Brachet
atexit handler
2022-03-10[libc] Add a resizable container with constexpr constructor and destructor.Siva Chandra Reddy
The new container is used to store atexit callbacks. This way, we avoid the possibility of the destructor of the container itself getting added as an at exit callback. Reviewed By: abrachet Differential Revision: https://reviews.llvm.org/D121350
2022-03-10[libc] Use the constexpr constructor to initialize exit handlers mutex.Siva Chandra Reddy
Reviewed By: abrachet Differential Revision: https://reviews.llvm.org/D121334
2022-02-17[libc] Add exit and atexitAlex Brachet
Often atexit is implemented using __cxa_atexit. I have not implemented __cxa_atexit here because it potentially requires more discussion. It is unique for llvm-libc (I think) that it is an exported symbol that wouldn’t be defined in any spec file because it doesn’t have a header. Implementing it will be trivial given what is here already, but I figured it would be more contentious so it can be implemented later. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D119512