Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

options/rtld: Call fini functions on exit #1092

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Qwinci
Copy link
Contributor

@Qwinci Qwinci commented Jul 17, 2024

This is needed to support functions marked with attribute gnu::destructor. The way I implemented it it destructs the objects in reverse order that they were initialized in and first runs functions registered with __cxa_atexit for the object and after that the fini functions for that object, I am not sure if that's completely correct but to me it seems reasonable enough so in case of an object that doesn't have any circular dependencies both the atexit functions and destructor functions are run after the object can't be used by anything anymore. It turned out that there is an autogenerated call to __cxa_finalize that should call the functions registered for that dso, so I implemented that.

@Qwinci Qwinci force-pushed the fini branch 3 times, most recently from d797b8f to a2bdcb0 Compare July 17, 2024 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant