-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Reimplement resolve_path in JS Take 2 NFC #23958
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
Conversation
One concern I have here is generally moving code from native to JS is that opposite direction that we've been trying to move a long time in emscripten. Would it be possible to invert this have the JS code call into native code to do the LD_LIBRARY_PATH and filesystem searching? |
I guess on problem is that the dyanmic linking code can sometime run before the native code is ready to execute? |
On the other hand with wasmfs we require the native code to be running in order to even use the filesystem. |
I can try going the opposite direction. I see no reason that it wouldn't work. |
When will that happen? Does preloading files happen before the native code is ready to execute? |
Well it happens before malloc is ready to execute. I think if the code doesn't allocate anything it should work fine. |
Yes, if you have main module with a set of side modules (in the So I guess I'm going back and forth on this... it would be nice if it could be native, but also maybe there are reasons why it cannot be. I'm actually concerned now that the design of wasmfs is going to be a problem here since the FS itself is implemented in native code. @tlively @kripken |
I'm having trouble following the issue here, as explanations refer to a long previous discussion, and I don't see a concrete testcase in the PR that I could learn from. Can someone perhaps summarize things? |
The goal is to implement RPATH support. So we need a function that checks for a library first in zero or more If the |
Thanks @hoodmane ! We do have some emscripten/system/lib/libc/dynlink.c Lines 517 to 527 in 975084c
So it seems natural to extend that. As @sbc100 mentioned, though, we should see about WasmFS - this PR uses |
When we have a test here, we can test WasmFS by just adding the |
Closing because #23872 went a different way. |
Reopening #23935
As discussed in #23872, this PR reimplements resolve_path function, which is used to locate the library using LD_LIBRARY_PATH in JavaScript, so that it can be reused inside libdylink.js.
Currently, this code doesn't work in thread.