-
Notifications
You must be signed in to change notification settings - Fork 74
Description
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
-
Add a new subsection type in dylink.0 section:
WASM_DYLINK_RUNTIME_PATH.
a.5 / WASM_DYLINK_RUNTIME_PATH -
This subsection contains following fields:
b.stringpath: the rpath string -
The special string
$ORIGINneed to be supported.
c.$ORIGINrepresents the directory where the WASM module is located in the (virtual) filesystem. -
Let emscripten use this field to locate the shared library in the runtime.
cc: @hoodmane