-
Notifications
You must be signed in to change notification settings - Fork 968
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
Two-level namespace #34
Conversation
277cf8c
to
580cd78
Compare
I've cleaned this up, hopefully this can get a reviewer or two. @grp do you have any thoughts on this, either in general or on the code? |
I don't know much about the implementation of two-level namespacing. :( It looked cool reading through it, though. |
I'll review this in a ~week, hopefully that will give me somewhat fresh eyes to catch bugs, issues, readability problems, etc. I'd like to write a few more tests too (though I probably won't check the tests in). |
Allow backward compatibility symbol search (all dylibs) by specifying a NULL dylib in the `rebinding`.
580cd78
to
e7f34c0
Compare
Thank you for your pull request. We require contributors to sign our Contributor License Agreement, and yours has expired. Before we can review or merge your code, we need you to email [email protected] with your details so we can update your status. |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
This change adds support for rebinding that leverages mach-o's two-level namespace.
The tl;dr of two-level namespaces is that symbols imported from other libraries will reference which library they came from. When rebinding a symbol by name alone, it's possible to unintentionally rebind symbols that happen to have the same name, which can cause unexpected results. Using the two-level namespace prevents the mysterious bugs and crashes that can happen when rebinding by just symbol name alone.
In addition to correctness, this change opens a new performance optimization, see 7cc0515.
This change is a breaking change: callers of
rebind_symbols
now need to fill in adylib
field on therebinding
struct. This field can beNULL
to opt-out of two-level namespaces, and enable the previous global search.Resolves #32