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

Jacob Gravelle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 1 14:19:31 PST 2018


jgravelle-google added a comment.

Additional thoughts of mine:

Who are the expected users of these symbols? Anyone who wants to call `__wasm_call_ctors` or read `__data_end` are probably building their own external `start` function, or writing their own `malloc`.
But what kind of program will want to use the memory export? Any program that wants to pass structs or strings across a wasm boundary.
What kind of program will need to use an imported memory's name? Well, all of them.

My philosophy in this is that most users shouldn't need to touch anything `__`-prefixed, though toolchain authors should be expected to.

So I think in the limit we'll want to have a flag for this, so that non-Emscripten users can use whatever they think makes sense. At which time we should change the default to be `__`-prefixed. But I'm not sure if we have enough user-driven need to say for sure.
>From an Emscripten perspective, the best thing I can think of to do is to have the `wasm-emscripten-finalize` tool in Binaryen rewrite the memory import from whatever name it has to whatever Emscripten expects. This is one point of change, LLD doesn't need to know it exists, Emscripten doesn't need to change that string depending on what it's targeting. We don't need a flag just for Emscripten, but we may want a flag for non-Emscripten toolchains.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D43675





More information about the llvm-commits mailing list