[PATCH] D150803: Add a new `wasm_custom` clang attribute for marking functions.

Sam Clegg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 13 15:29:15 PDT 2023


sbc100 accepted this revision.
sbc100 added a comment.
This revision is now accepted and ready to land.

Nice!



================
Comment at: lld/test/wasm/merge-custom-attr-section.ll:47
+}
+
+attributes #0 = { "wasm-custom"="custom0" }
----------------
Is there some reason we can't use assembly for this test?


================
Comment at: lld/wasm/InputChunks.cpp:530
   if (!name.startswith(".debug_"))
     return 0;
   if (name.equals(".debug_ranges") || name.equals(".debug_loc"))
----------------
Can we switch the logic around so that the default `return 0;` is that last line of the function.   Then your new use case could be added right before that line.

e.g. 
```
 if (name.startswith(".debug_"))
    return UINT64_C(-1)
```



================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp:569
+      if (!CustomSections.contains(Name))
+        CustomSections[Name] = {};
+      CustomSections[Name].push_back(Sym);
----------------
Are these two lines needed?  i.e. does the subscript operator automatically create an empty element when its first used?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150803



More information about the cfe-commits mailing list