[PATCH] D70520: [WebAssembly] Add new `export_name` clang attribute for controlling wasm export names

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 20 17:40:08 PST 2019


sbc100 created this revision.
Herald added subscribers: llvm-commits, cfe-commits, sunfish, aheejin, hiraditya, jgravelle-google, dschuff.
Herald added projects: clang, LLVM.
sbc100 added a comment.
sbc100 added reviewers: dschuff, sunfish.

First stab at getting this attribute plumbed all the way through.

Do you think that setting this attribute should also prevent GC?

I could split this up into clang, llvm, and lld parts if it makes reviewing simpler.


This is equivalent to the existing `import_name` and `import_module`
attributes which control the import names in the final wasm binary
produced by lld.

This maps the existing

This attribute currently requires a string rather than using the
symbol name for a couple of reasons:

1. Avoid confusion with static and dynamic linking which is based on symbol name.  Exporting a function from a wasm module using this directive is orthogonal to both static and dynamic linking.
2. Avoids name mangling.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70520

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/CodeGen/wasm-export-name.c
  lld/test/wasm/export-name.ll
  lld/test/wasm/import-name.ll
  lld/test/wasm/import-names.ll
  lld/wasm/InputChunks.h
  lld/wasm/Writer.cpp
  llvm/include/llvm/BinaryFormat/Wasm.h
  llvm/include/llvm/MC/MCSymbolWasm.h
  llvm/include/llvm/Object/Wasm.h
  llvm/lib/MC/WasmObjectWriter.cpp
  llvm/lib/Object/WasmObjectFile.cpp
  llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h
  llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
  llvm/test/CodeGen/WebAssembly/export-name.ll
  llvm/test/MC/WebAssembly/export-name.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70520.230357.patch
Type: text/x-patch
Size: 20799 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191121/03347f0f/attachment.bin>


More information about the llvm-commits mailing list