[PATCH] D43675: [WebAssembly] Rename imported/exported memory symbol to __linear_memory

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 1 09:19:55 PST 2018


sbc100 added a comment.

As long as emscripten can control the things it needs to we can di

In https://reviews.llvm.org/D43675#1023703, @ncw wrote:

> In https://reviews.llvm.org/D43675#1021108, @sbc100 wrote:
>
> > Might be easier to add a command line flag to control the name here, rather than changing emscripten?
>
>
> But we don't do that for other linker-provided symbols like `__wasm_call_ctors `or `__stack_pointer`, so why should we do it for `__linear_memory`? We do provide a commandline-parameter for the entry-point, but that's a user-provided symbol so it's not really the same.
>
> I've made an Emscripten pull request here, to be merged at the same time as this change: https://github.com/kripken/emscripten/pull/6293


The only reason would be to allow lld to be flexible enough to meet emscripten's needs.  I've got a feeling that changing this on the emscripten side my be more complex than that change you propose there.  Remember there is the asm2wasm and s2wasm case too.   I imagine that this name is assumed and used in more places.   My guiding principle here is that lld need to be able to support the needs of emscripten but try to avoid making our output emscripten-specific where possible.   Command line flags that emscripten can use to alter the lld behaviour are reasonable in some cases.  Maybe this is one of them, maybe not?

An alternative change on the emscripten side would be have the emscripten tool that post-processes the wasm file rename the memory export (this tool already exists and will continue to exist for the foreseeable and it seems reasonable for it to do this kind of thing).
@jgravelle-google what do you think?


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D43675





More information about the llvm-commits mailing list