[PATCH] D131376: [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
Mon Aug 15 08:57:34 PDT 2022


sunfish added a comment.

In curious why memorytExports is a set of strings rather than an optional string. Is there a need for exporting the memory with multiple names?

I can envision a possible need, which is to build modules that export both "memory" and "cabi_memory". I'm open to supporting something like that if there's an acute need for it, but I'm also hesitant, because

In D131376#3720931 <https://reviews.llvm.org/D131376#3720931>, @Liamolucko wrote:

> In D131376#3716714 <https://reviews.llvm.org/D131376#3716714>, @sbc100 wrote:
>
>> In D131376#3711300 <https://reviews.llvm.org/D131376#3711300>, @Liamolucko wrote:
>>
>>>> 1. Are there going to be other cabi-relatated things, that warrent just putting this behind a single "cabi" flag rather than requiring N different flags for this?
>>>
>>> Yeah, the linker will also have to merge together `cabi_start` definitions, so using a unified flag makes more sense. I'll make a new patch to do it that way. Does Phabricator have a way to close this one?
>>
>> That does `cabi_start` represent?  If its the equivalent of `main` we probably don't want the linker to merge them but instead reject programs that contain more than one (just like any other symbol).
>
> It's the component-model equivalent of WebAssembly start functions, which //can// be used for `main` but are mainly meant for initialization. Fully-fledged components are explicitly allowed to have multiple, so I think it makes sense to merge them.

I think the canonical ABI will need support for multiple `cabi_start` functions, so that we don't have to merge them. I filled https://github.com/WebAssembly/component-model/issues/88 to track this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131376



More information about the llvm-commits mailing list