[PATCH] D130065: [X86] Use Min behavior for cf-protection-{return,branch}/ibt-seal module flags
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 19 01:35:45 PDT 2022
MaskRay created this revision.
MaskRay added reviewers: craig.topper, joaomoreira, pengfei, xiangzhangllvm.
Herald added subscribers: jsji, StephenFan.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
These features require that all object files are compiled with the support. When
the feature is disabled for an object file, the merge behavior should treat the
file having a value of 0 (see D129911 <https://reviews.llvm.org/D129911>).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D130065
Files:
clang/lib/CodeGen/CodeGenModule.cpp
clang/test/CodeGen/X86/x86-cf-protection.c
Index: clang/test/CodeGen/X86/x86-cf-protection.c
===================================================================
--- clang/test/CodeGen/X86/x86-cf-protection.c
+++ clang/test/CodeGen/X86/x86-cf-protection.c
@@ -8,7 +8,7 @@
// RETURN: #define __CET__ 2
// BRANCH: #define __CET__ 1
// 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}
// NOIBTSEAL-NOT: "ibt-seal", i32 1
void foo() {}
Index: clang/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -743,19 +743,19 @@
if (CodeGenOpts.CFProtectionReturn &&
Target.checkCFProtectionReturnSupported(getDiags())) {
// 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);
}
if (CodeGenOpts.CFProtectionBranch &&
Target.checkCFProtectionBranchSupported(getDiags())) {
// Indicate that we want to instrument branch control flow protection.
- getModule().addModuleFlag(llvm::Module::Override, "cf-protection-branch",
+ getModule().addModuleFlag(llvm::Module::Min, "cf-protection-branch",
1);
}
if (CodeGenOpts.IBTSeal)
- getModule().addModuleFlag(llvm::Module::Override, "ibt-seal", 1);
+ getModule().addModuleFlag(llvm::Module::Min, "ibt-seal", 1);
if (CodeGenOpts.FunctionReturnThunks)
getModule().addModuleFlag(llvm::Module::Override, "function_return_thunk_extern", 1);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130065.445727.patch
Type: text/x-patch
Size: 1796 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220719/18f3fcac/attachment-0001.bin>
More information about the cfe-commits
mailing list