WebAssembly / WebAssembly/tool-conventions

which memory dynamic-linking libraries should use for host functions?

Open
#232 16 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

https://github.com/WebAssembly/WASI/blob/main/legacy/application-abi.md says:

Regardless of the kind, all modules accessing WASI APIs also export a linear memory with the name memory. Data pointers in WASI API calls are relative to this memory's index space.

i guess it's the convention used by many of host functions, not only WASI.

however, wasi-libc's libc.so doesn't export "memory".

actually, wasm-ld rejects -shared -export-memory.
https://github.com/llvm/llvm-project/blob/06a808c4f4014edfeb2517bddd0bcb63eb4a260b/lld/wasm/Driver.cpp#L658

am i missing something?

a. wasm-ld should be fixed.

b. application-abi.md doesn't apply to a module which is a shared library.
the memory exported from the "main" module should always be used.
i feel this a bit strange because the module calling wasi (eg. libc.so) doesn't know about the "main" module.

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

Read legacy/application-abi.md and inspect wasi-libc's libc.so export behavior. Then compare the shared-library handling in lld/wasm/Driver.cpp around the cited line with the two alternatives in the issue. Done means establishing and documenting the applicable memory convention, or identifying the specific tool change required.

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.