[WebAssembly] Add mechanisms for specifying an explicit import module name.
authorDan Gohman <dan433584@gmail.com>
Fri, 9 Feb 2018 23:13:22 +0000 (23:13 +0000)
committerDan Gohman <dan433584@gmail.com>
Fri, 9 Feb 2018 23:13:22 +0000 (23:13 +0000)
commitdb1916a64620b3261fed450cbde047c730d758b5
treeea5c58b41aae499f81679568893c6062ec390f88
parent861bec2b7c69d885586725b9b0166913dbae6826
[WebAssembly] Add mechanisms for specifying an explicit import module name.

This adds a wasm-import-module function attribute and a .import_module
assembler directive, for specifying module import names for WebAssembly.
Currently these may only be used for function symbols; global variables
may be considered in the future.

WebAssembly has a two-level namespace scheme for symbols, and it's
normally the linker's job to assign the module name, which is the
first-level name. The attributes here allow users to specify their
own module names explicitly, which is useful for tools generating
bindings to modules defined in other languages.

This feature is not fully usable yet. It will evolve along with the
ongoing symbol table and lld changes.

Differential Revision: https://reviews.llvm.org/D42520

llvm-svn: 324778
llvm/include/llvm/MC/MCSymbolWasm.h
llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp
llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h
llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
llvm/test/CodeGen/WebAssembly/import-module.ll [new file with mode: 0644]
llvm/test/MC/WebAssembly/external-func-address.ll