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

Proposal: a new subsection type in dylink.0 section to support runtime path #244

Open
ryanking13 opened this issue Dec 20, 2024 · 0 comments

Comments

@ryanking13
Copy link

Summary

I propose a new subsection type in dylink.0 section: WASM_DYLINK_RUNTIME_PATH.

This subsection is basically equivalent to runtime path (RPATH) in Linux, which is passed from the -rpath flag.

Background

The overall background is explained in the issue in the Emscripten repository: emscripten-core/emscripten#22126

In Pyodide (Python runtime for the browser), we install packages during the runtime. Installing and loading packages requires loading multiple WASM modules (in Linux terms, shared libraries; in Emscripten terms, side modules) in the package, which has dependency relations.

In order to make the Python package portable, python packages often put all the shared libraries in the package and set the RPATH to the relative path to the shared libraries (PEP 513). However, currently Emscripten does not support RPATH in the WASM module, so we've been hacking around the internal Emscripten code to inject the directory path to the shared libraries.

So, I propose to add support for the runtime path.

Proposal Details

  1. Add a new subsection type in dylink.0 section: WASM_DYLINK_RUNTIME_PATH.
    a. 5 / WASM_DYLINK_RUNTIME_PATH

  2. This subsection contains following fields:
    b. string path: the rpath string

  3. The special string $ORIGIN need to be supported.
    c. $ORIGIN represents the directory where the WASM module is located in the (virtual) filesystem.

  4. Let emscripten use this field to locate the shared library in the runtime.


cc: @hoodmane

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

No branches or pull requests

1 participant