WebAssembly / WebAssembly/tool-conventions

Dynamic Linking: imports module name

Open
#135 4 comments 0 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

Hello,

I have been experimenting with wasm dynamic linking, and have a question. If I define a module foo which depends on the function f in module bar, using the --shared linker flag bar gets put into the dylink section of foo. The function f gets put in the import section along with the other needed globals and memories etc. However, the module name argument of the import of f is env, and not bar. So the import becomes env.f and not bar.f.

Is this intended behaviour? And if so, why? I would expect the module name for the import to be the actual name of the module the import originates from. It also seems logical to have the module name env reserved for imports that the interpreter provides, such as functions to interact with the interpreter.

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

Start by reviewing the dynamic-linking behavior described for the dylink and import sections, focusing on why the imported function uses the env module name instead of bar. Determine whether this matches the tool-convention expectations and document the intended behavior and rationale, or identify the convention change needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.