[PATCH] D130065: [X86] Use Min behavior for cf-protection-{return,branch}/ibt-seal module flags

Xiang Zhang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 19 18:03:12 PDT 2022


xiangzhangllvm added inline comments.


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:746
     // Indicate that we want to instrument return control flow protection.
-    getModule().addModuleFlag(llvm::Module::Override, "cf-protection-return",
+    getModule().addModuleFlag(llvm::Module::Min, "cf-protection-return",
                               1);
----------------
Take "cf-protection-return" for example:
I pass  the "-fcf-protection=**none**" for following test x86-cf-protection.c
It doesn't has "!{i32 Module::Min, !"cf-protection-return", i32 **0**}".


================
Comment at: clang/test/CodeGen/X86/x86-cf-protection.c:11
 // FULL: #define __CET__ 3
-// CFPROT: "cf-protection-branch", i32 1
-// IBTSEAL: "ibt-seal", i32 1
+// CFPROT: !{i32 8, !"cf-protection-branch", i32 1}
+// IBTSEAL: !{i32 8, !"ibt-seal", i32 1}
----------------
Seems we miss check the "llvm::Module::Override" (4) before, now is better.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130065



More information about the cfe-commits mailing list