[PATCH] D42520: Implement __attribute__((import_module("foo")))

Dan Gohman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 24 21:04:49 PST 2018


sunfish created this revision.
Herald added subscribers: llvm-commits, aheejin, jgravelle-google, dschuff, jfb.

This creates an attribute for specifying an explicit import module name for a function declaration. It also renames the default module import name from "env" to "__linker_resolve", which should be less likely to collide with other things, though I'm open to other suggestions.

The expectation is that it's the linker's job to resolve symbols that have the default module name, so that they're either linked to a definition in the same resulting module, or to a definition in a separate module with two-level namespacing. Modules with non-default names should be left alone.

It only applies to functions for now; we can generalize it for global variables later if needed.


Repository:
  rL LLVM

https://reviews.llvm.org/D42520

Files:
  include/llvm/MC/MCSymbolWasm.h
  lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp
  lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h
  lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
  test/CodeGen/WebAssembly/import-module.ll
  test/MC/WebAssembly/comdat.ll
  test/MC/WebAssembly/external-func-address.ll
  test/MC/WebAssembly/global-ctor-dtor.ll
  test/MC/WebAssembly/stack-ptr.ll
  test/MC/WebAssembly/weak-alias.ll
  test/MC/WebAssembly/weak.ll
  tools/clang/include/clang/Basic/Attr.td
  tools/clang/lib/CodeGen/TargetInfo.cpp
  tools/clang/lib/Sema/SemaDeclAttr.cpp
  tools/clang/test/CodeGen/wasm-import-module.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42520.131388.patch
Type: text/x-patch
Size: 18546 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180125/50ccddb2/attachment.bin>


More information about the llvm-commits mailing list