[wasm-ld] Allow importing/exporting the output module's memory with arbitrary names
authorDan Gohman <dev@sunfishcode.online>
Tue, 4 Oct 2022 19:50:10 +0000 (12:50 -0700)
committerDan Gohman <dev@sunfishcode.online>
Mon, 31 Oct 2022 20:59:46 +0000 (13:59 -0700)
commitd4c8a0edca51d83b084291960eea6664b9f56327
treea4360dc0e83945421ee16457d9f96f08f02689c2
parenta3a9fffea1bfd14ea509007cbf4f9fdb4d602c7c
[wasm-ld] Allow importing/exporting the output module's memory with arbitrary names

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.

Differential Revision: https://reviews.llvm.org/D135898
lld/test/wasm/memory-naming.test [new file with mode: 0644]
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