sunfish added a comment.

It appears this doesn't handle exporting an imported function yet, which is 
fine for now, but it would be good to issue a warning, because wasm itself is 
capable of representing this:

  void aaa(void) __attribute__((import_module("imp"), import_name("foo"), 
export_name("bar")));



================
Comment at: lld/wasm/Writer.cpp:523
+      StringRef exportName = f->function->getExportName();
+      if (!exportName.empty()) {
+        name = exportName;
----------------
For wasm exports, it's valid to have empty strings. In fact, I may even have a 
usecase which wants an empty-string export. It'd be good to use `Optional<>` 
for export names, rather than special-casing the empty string.

(wasm-ld does often special-case the empty string in symbol names, but wasm 
export strings aren't ordinary symbol names, so it'd be good to follow wasm's 
rules for them.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70520/new/

https://reviews.llvm.org/D70520



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to