[PATCH] D21768: Support CFI for WebAssembly target

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 18:34:20 PDT 2016


pcc added a comment.

> This is because f() gets assigned to table index 0 by s2wasm, and the check fails. Note that this is true regardless of whether the CFI pass is enabled; there are no indirect function calls being executed, so it doesn't affect the IR at all.


So it sounds like maybe s2wasm and this pass should both be assigning indexes starting at 1? Although calls to null function pointers are undefined, null comparisons are well-defined in C++. Feel free to ignore this though with regard to this patch, as it seems like a pre-existing design issue.


================
Comment at: lib/Transforms/IPO/LowerTypeTests.cpp:843
@@ +842,3 @@
+    // entries in the indirect function table.
+    if (!F->getNumUses())
+      continue;
----------------
You may want to use `Function::hasAddressTaken` to exclude direct function calls here.

Please also document how this interacts with dynamic loading (i.e. not at all at the moment, right?)


http://reviews.llvm.org/D21768





More information about the llvm-commits mailing list