-
-
Notifications
You must be signed in to change notification settings - Fork 140
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
rtld: invoke fini functions #1163
Conversation
This reverts commit 352b2f7.
1371687
to
94d3c42
Compare
I'd prefer to not support circular dependencies as these are quite broken anyway. |
Agreed, I misread the code and thought it was ensuring there were no circular dependencies, but actually this code is adding explicit support for it. This PR should keep the old code. |
I've removed handling of circular deps and removed crt{begin,end}.S so that we no longer support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
#1092 was previously reverted because it caused a regression. In particular, it relied on DSOs to invoke
__cxa_finalize
, but mlibc itself is missing a call to__cxa_finalize
in crtbegin, so any libc-related destructors (such as the guard that flushes all open files) were not run.Fix this by adding a
[[gnu::destructor]]
function which calls__cxa_finalize
with our own__dso_handle
.Also, while refactoring, I noticed that the
crt{begin,end}.S
are no longer needed (they were used for.ctor
/.dtor
handling, which we no longer use), and provided the definition of__dso_handle
(which I've moved into C++).Also add a regression test to ensure we run libc destructors somehow.