[PATCH] D135898: [wasm-ld] Allow importing/exporting the output module's memory with arbitrary names

Dan Gohman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 13 11:01:47 PDT 2022


sunfish created this revision.
sunfish added a reviewer: sbc100.
Herald added subscribers: pmatos, asb.
Herald added a project: All.
sunfish requested review of this revision.
Herald added a subscriber: aheejin.
Herald added a project: LLVM.

This adds an `--export-memory` option to wasm-ld which allows passing
a name to give to the exported memory, and extends `--import-memory` to
allow passing a <module>,<name> pair specifying where the memory should
be imported from.

      

This is based on https://reviews.llvm.org/D131376, with the main
difference being that it only supports exporting memory by one name.

I know the discussion in D131376 <https://reviews.llvm.org/D131376> was toward looking into ways to do this by
declaring memories in the source code, and that still makes sense to look into
for more advanced use cases, but for the common case, we don't have any
other reason to declare memory explicitly; we just want lld to use a different
name from the one hard-coded into it, so this adds a way to do that.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D135898

Files:
  lld/test/wasm/memory-naming.test
  lld/wasm/Config.h
  lld/wasm/Driver.cpp
  lld/wasm/Options.td
  lld/wasm/Symbols.cpp
  lld/wasm/Symbols.h
  lld/wasm/SyntheticSections.cpp
  lld/wasm/SyntheticSections.h
  lld/wasm/Writer.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135898.467541.patch
Type: text/x-patch
Size: 11049 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221013/7cbaa714/attachment.bin>


More information about the llvm-commits mailing list