WebAssembly / WebAssembly/tool-conventions

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

Open
#244 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
372
Forks
75
PR merge metrics
No merged PRs in 30d

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: https://github.com/emscripten-core/emscripten/issues/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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository files or tests are named. Start by reading the proposed dylink.0 subsection details and the linked Emscripten issue, then trace how runtime loading currently locates shared libraries. Done means defining the subsection format, supporting $ORIGIN, and specifying how the runtime uses the path.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.