-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Need a way to load the _rust_crate_map_toplevel from a SO on Android #11731
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
Comments
Hm, this thread seems to indicate that this is "just how android is". As in, It appears that libreoffice has their own version of the function, http://motah.org.sa/dev/libreoffice.git/sal/android/lo-bootstrap.c Unsure if we'd want to bundle that inside of rust itself? |
The The main problem for us (when using the windows path instead of the weak symbol path) is not that |
Could you possible expose a function that I could call from C to set the toplevel crate map? We're going to be looking to upgrade Rust soon, and without a way to help the Rust runtime find the crate map when loaded as a shared library, we will have to continue having a funky android-only patch that "knows" to look in the libservo.so crate for it, ala: (ignore all the debugging output :-)) |
Hm, I believe we could, I would imagine something along the lines of: static mut MANUAL_CRATE_MAP: *CrateMap = 0 as *CrateMap;
#[no_mangle]
pub extern fn rust_set_crate_map(map: *CrateMap) {
unsafe { MANUAL_CRATE_MAP = map; }
} And then all functions using the crate map would check if Basically, yes, it could be possible. |
@larsbergstrom, would something like that work for servo? |
Yes, definitely! If it's easier, we can alternatively provide the module name to look in for the symbol (though I guess that only works on dlsym-using platforms. Thanks! |
Apparently weak linkage and dlopen aren't quite working out for applications like servo on android. There appears to be a bug or two in how android loads dynamic libraries and for some reason libservo.so isn't being found. As a temporary solution, add an extern "C" function to libstd which can be called if you have a handle to the crate map manually. When crawling the crate map, we then check this manual symbol before falling back to the old solutions. cc rust-lang#11731
Apparently weak linkage and dlopen aren't quite working out for applications like servo on android. There appears to be a bug or two in how android loads dynamic libraries and for some reason libservo.so isn't being found. As a temporary solution, add an extern "C" function to libstd which can be called if you have a handle to the crate map manually. When crawling the crate map, we then check this manual symbol before falling back to the old solutions. cc #11731
Apparently weak linkage and dlopen aren't quite working out for applications like servo on android. There appears to be a bug or two in how android loads dynamic libraries and for some reason libservo.so isn't being found. As a temporary solution, add an extern "C" function to libstd which can be called if you have a handle to the crate map manually. When crawling the crate map, we then check this manual symbol before falling back to the old solutions. cc rust-lang#11731
For Servo on Android, Rust is unable to find the
_rust_crate_map_toplevel
because dlsym will not search all of the loaded modules in The Normal Way. This problem has caused us to currently change the implementation ofget_crate_map
as follows:It would be better if there was some way to provide the runtime with the name of the binary that contains the toplevel crate map.
CC: @aydinkim
The text was updated successfully, but these errors were encountered: