[PATCH] D26875: [WebAssembly] Emit .import_global assembler directives

Derek Schuff via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 11:35:45 PST 2016


dschuff added a comment.

I think this is fine for now too. For the longer term, I kind of think it depends on the use case.

For the case of something that looks like a traditional self-contained C program, I think we'd want to have undefined symbols behave like they do in traditional toolchains (which will be less surprising, and diagnose errors at link time rather than at load time).

For dylibs meant to be loaded by LLVM-built "main" modules, we probably just want something explicit (in the source) like `dllimport` or ELF visibility or whatever.

For a new/hybrid use case of a wasm library meant to be used from JS, that will be sort of like linking a dylib but not exactly (may have a different ABI, etc).

For the dylib/JS-module use case it might be useful to have the linker automatically convert undefined symbols to imports (as is the default in ELF for example). Although given the popularity and usefulness of `-fvisibility=hidden`, maybe it's not what we actually want. In any case I think we may want some explicit way to model it in the contract between the compiler and the linker, to at least allow for different ways to make it work? Anyway, we should probably discuss more in a github issue or something.


https://reviews.llvm.org/D26875





More information about the llvm-commits mailing list