[PATCH] D145308: [lld][WebAssembly] Initial support for stub objects

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 9 09:51:28 PST 2023


sbc100 added a comment.

In D145308#4181854 <https://reviews.llvm.org/D145308#4181854>, @dschuff wrote:

> I think this feature could also be useful in non-emscripten environments, e.g. you could have a stub library for each WASI API provided by the embedder. Does wasi-sdk just use `--allow-undefined` for this now? Stub libraries seem nicer than that.
> @sunfish WDYT, does this look useful?

I think wasi sdk currently relies on `__attribute__(import_name)` for all the WASI syscalls, but users who want to add more/custom imports often do `--allow-undefined` or `--allow-undefined-file=`.

I don't think there is any way to express the reverse dependencies (such as malloc/free), that imports have, and this would allow that.   Having said that WASI itself doesn't have suck reverse dependencies (at least not that I know of).   I believe the component model bakes in the code dependency on malloc/free, so this could be useful for making process towards supporting the the component module in wasm-ld.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145308/new/

https://reviews.llvm.org/D145308



More information about the llvm-commits mailing list