[clang] 3cbf904 - [X86][test] Add -fcf-protection test for pre-pentiumpro

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 3 22:21:49 PDT 2022


Author: Fangrui Song
Date: 2022-11-03T22:21:44-07:00
New Revision: 3cbf90468aecce960887e680f813cbb1209b337f

URL: https://github.com/llvm/llvm-project/commit/3cbf90468aecce960887e680f813cbb1209b337f
DIFF: https://github.com/llvm/llvm-project/commit/3cbf90468aecce960887e680f813cbb1209b337f.diff

LOG: [X86][test] Add -fcf-protection test for pre-pentiumpro

For #58737

Added: 
    

Modified: 
    clang/test/CodeGen/X86/x86-cf-protection.c

Removed: 
    


################################################################################
diff  --git a/clang/test/CodeGen/X86/x86-cf-protection.c b/clang/test/CodeGen/X86/x86-cf-protection.c
index de6906ec51812..9f0cafc2eb456 100644
--- a/clang/test/CodeGen/X86/x86-cf-protection.c
+++ b/clang/test/CodeGen/X86/x86-cf-protection.c
@@ -4,6 +4,7 @@
 // RUN: %clang -target i386-unknown-unknown -o - -emit-llvm -S -fcf-protection=branch -mibt-seal -flto %s | FileCheck %s --check-prefixes=CFPROT,IBTSEAL
 // RUN: %clang -target i386-unknown-unknown -o - -emit-llvm -S -fcf-protection=branch -flto %s | FileCheck %s --check-prefixes=CFPROT,NOIBTSEAL
 // RUN: %clang -target i386-unknown-unknown -o - -emit-llvm -S -fcf-protection=branch -mibt-seal %s | FileCheck %s --check-prefixes=CFPROT,NOIBTSEAL
+// RUN: not %clang_cc1 -emit-llvm-only -triple i386 -target-cpu pentium-mmx -fcf-protection=branch %s 2>&1 | FileCheck %s --check-prefix=NOCFPROT
 
 // RETURN: #define __CET__ 2
 // BRANCH: #define __CET__ 1
@@ -11,4 +12,7 @@
 // CFPROT: !{i32 8, !"cf-protection-branch", i32 1}
 // IBTSEAL: !{i32 8, !"ibt-seal", i32 1}
 // NOIBTSEAL-NOT: "ibt-seal", i32 1
+
+// NOCFPROT: error: option 'cf-protection=branch' cannot be specified on this target
+
 void foo() {}


        


More information about the cfe-commits mailing list