[PATCH] D119296: KCFI sanitizer

Sami Tolvanen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 20 15:14:29 PDT 2022


samitolvanen added inline comments.


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:2268-2272
+    if (!AddressTaken && F.hasLocalLinkage()) {
+      F.setPrefixData(nullptr);
+      F.removeFnAttr("kcfi");
+      continue;
+    }
----------------
nickdesaulniers wrote:
> Can we not compute whether the address was taken BEFORE adding the prefix + Fn Attr and avoid adding these only to remove them later?
> Can we not compute whether the address was taken BEFORE adding the prefix + Fn Attr and avoid adding these only to remove them later?

Setting these in `SetFunctionAttributes` where we have convenient access to the `FunctionDecl` seemed like the right thing to do, and I don't believe we know whether the address is taken until we're done with the module. Is there a better place for this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119296



More information about the cfe-commits mailing list