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

Exposes libc::dlopen flags for unix platform. #7

Merged
merged 1 commit into from
Feb 6, 2024

Conversation

whereskenneth
Copy link

I have a requirement for passing the RTLD_NOW flag to libc::dlopen.

This situation arises when undefined symbols in a shared library are present. The undefined symbols are ultimately defined, but in another library that is linked into the library being loaded.

For example:

$ ldd a.so
# a.so links to b.so and c.so
b.so
c.so

$ nm -D b.so
# Foo is undefined in b.so
U  Foo

$ nm -D c.so
# Foo later defined in c.so
0000000008 T Foo

Using default flags of RTLD_LOCAL | RTLD_LAZY, for some reason, causes Foo to not be found during runtime.

Testing revealed LD_BIND_NOW=1 works to override this behavior, but that is unfeasible for my use case. I need to be able to specify RTLD_NOW as a flag when callinglibc::dlopen.

Therefore, I augmented the public interface to support opening a library with flags: Option<i32> . Passing None preserves the current behavior. This is a non-breaking change to the public API as far as I can tell.

@OpenByteDev OpenByteDev merged commit c50e261 into OpenByteDev:master Feb 6, 2024
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.

None yet

2 participants