diff options
author | Alexander Potapenko <glider@google.com> | 2018-09-07 09:21:09 +0000 |
---|---|---|
committer | Alexander Potapenko <glider@google.com> | 2018-09-07 09:21:09 +0000 |
commit | d49c32ce3f3f87ae7b04c168438a038a632db0c1 (patch) | |
tree | 707484c721249c3c31e89adf6288855bef4c1299 /clang/lib/CodeGen/CGDeclCXX.cpp | |
parent | e5536b972f053d8c30a444e429e2dd39505aa37c (diff) | |
download | bcm5719-llvm-d49c32ce3f3f87ae7b04c168438a038a632db0c1.tar.gz bcm5719-llvm-d49c32ce3f3f87ae7b04c168438a038a632db0c1.zip |
[MSan] add KMSAN support to Clang driver
Boilerplate code for using KMSAN instrumentation in Clang.
We add a new command line flag, -fsanitize=kernel-memory, with a
corresponding SanitizerKind::KernelMemory, which, along with
SanitizerKind::Memory, maps to the memory_sanitizer feature.
KMSAN is only supported on x86_64 Linux.
It's incompatible with other sanitizers, but supports code coverage
instrumentation.
llvm-svn: 341641
Diffstat (limited to 'clang/lib/CodeGen/CGDeclCXX.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDeclCXX.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp index e5c234fb9a8..4499eb93ebb 100644 --- a/clang/lib/CodeGen/CGDeclCXX.cpp +++ b/clang/lib/CodeGen/CGDeclCXX.cpp @@ -347,6 +347,10 @@ llvm::Function *CodeGenModule::CreateGlobalInitOrDestructFunction( !isInSanitizerBlacklist(SanitizerKind::Memory, Fn, Loc)) Fn->addFnAttr(llvm::Attribute::SanitizeMemory); + if (getLangOpts().Sanitize.has(SanitizerKind::KernelMemory) && + !isInSanitizerBlacklist(SanitizerKind::KernelMemory, Fn, Loc)) + Fn->addFnAttr(llvm::Attribute::SanitizeMemory); + if (getLangOpts().Sanitize.has(SanitizerKind::SafeStack) && !isInSanitizerBlacklist(SanitizerKind::SafeStack, Fn, Loc)) Fn->addFnAttr(llvm::Attribute::SafeStack); |