summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorOren Ben Simhon <oren.ben.simhon@intel.com>2018-03-17 13:29:46 +0000
committerOren Ben Simhon <oren.ben.simhon@intel.com>2018-03-17 13:29:46 +0000
commitfdd72fd5225dedb4431473fb3ac7b3d45fc8ed00 (patch)
treeb1819bd5c756e40209091ea07d752efab4cf83ac /llvm/lib/IR
parentdbcf1bf503880084e33e57e9fb916a66703d18d7 (diff)
downloadbcm5719-llvm-fdd72fd5225dedb4431473fb3ac7b3d45fc8ed00.tar.gz
bcm5719-llvm-fdd72fd5225dedb4431473fb3ac7b3d45fc8ed00.zip
[X86] Added support for nocf_check attribute for indirect Branch Tracking
X86 Supports Indirect Branch Tracking (IBT) as part of Control-Flow Enforcement Technology (CET). IBT instruments ENDBR instructions used to specify valid targets of indirect call / jmp. TheĀ `nocf_check` attribute has two roles in the context of X86 IBT technology: 1. Appertains to a function - do not add ENDBR instruction at the beginning of the function. 2. Appertains to a function pointer - do not track the target function of this pointer by adding nocf_check prefix to the indirect-call instruction. This patch implementsĀ `nocf_check` context for Indirect Branch Tracking. It also auto generatesĀ `nocf_check` prefixes before indirect branchs to jump tables that are guarded by range checks. Differential Revision: https://reviews.llvm.org/D41879 llvm-svn: 327767
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/Attributes.cpp2
-rw-r--r--llvm/lib/IR/Verifier.cpp1
2 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp
index 30216bcde68..0aea24f22c0 100644
--- a/llvm/lib/IR/Attributes.cpp
+++ b/llvm/lib/IR/Attributes.cpp
@@ -299,6 +299,8 @@ std::string Attribute::getAsString(bool InAttrGrp) const {
return "noredzone";
if (hasAttribute(Attribute::NoReturn))
return "noreturn";
+ if (hasAttribute(Attribute::NoCfCheck))
+ return "nocf_check";
if (hasAttribute(Attribute::NoRecurse))
return "norecurse";
if (hasAttribute(Attribute::NoUnwind))
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index b9df7c91a64..aec5c682296 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -1404,6 +1404,7 @@ Verifier::visitModuleFlag(const MDNode *Op,
static bool isFuncOnlyAttr(Attribute::AttrKind Kind) {
switch (Kind) {
case Attribute::NoReturn:
+ case Attribute::NoCfCheck:
case Attribute::NoUnwind:
case Attribute::NoInline:
case Attribute::AlwaysInline:
OpenPOWER on IntegriCloud