diff options
author | Philip Pfaffe <philip.pfaffe@gmail.com> | 2019-01-03 13:42:44 +0000 |
---|---|---|
committer | Philip Pfaffe <philip.pfaffe@gmail.com> | 2019-01-03 13:42:44 +0000 |
commit | b39a97c8f6c02f5ce9d048849dfae4c3ee26d5ee (patch) | |
tree | 2c869409a8f53707cc504dbbbf57ed11d9a668cb /llvm/bindings/go | |
parent | b0826bdffe48b91d9d1dad7437e2266635c5b7dd (diff) | |
download | bcm5719-llvm-b39a97c8f6c02f5ce9d048849dfae4c3ee26d5ee.tar.gz bcm5719-llvm-b39a97c8f6c02f5ce9d048849dfae4c3ee26d5ee.zip |
[NewPM] Port Msan
Summary:
Keeping msan a function pass requires replacing the module level initialization:
That means, don't define a ctor function which calls __msan_init, instead just
declare the init function at the first access, and add that to the global ctors
list.
Changes:
- Pull the actual sanitizer and the wrapper pass apart.
- Add a newpm msan pass. The function pass inserts calls to runtime
library functions, for which it inserts declarations as necessary.
- Update tests.
Caveats:
- There is one test that I dropped, because it specifically tested the
definition of the ctor.
Reviewers: chandlerc, fedor.sergeev, leonardchan, vitalybuka
Subscribers: sdardis, nemanjai, javed.absar, hiraditya, kbarton, bollu, atanasyan, jsji
Differential Revision: https://reviews.llvm.org/D55647
llvm-svn: 350305
Diffstat (limited to 'llvm/bindings/go')
-rw-r--r-- | llvm/bindings/go/llvm/InstrumentationBindings.cpp | 5 | ||||
-rw-r--r-- | llvm/bindings/go/llvm/InstrumentationBindings.h | 2 | ||||
-rw-r--r-- | llvm/bindings/go/llvm/transforms_instrumentation.go | 4 |
3 files changed, 6 insertions, 5 deletions
diff --git a/llvm/bindings/go/llvm/InstrumentationBindings.cpp b/llvm/bindings/go/llvm/InstrumentationBindings.cpp index 8b7bafa77ad..6ce43db620a 100644 --- a/llvm/bindings/go/llvm/InstrumentationBindings.cpp +++ b/llvm/bindings/go/llvm/InstrumentationBindings.cpp @@ -16,6 +16,7 @@ #include "llvm/IR/LegacyPassManager.h" #include "llvm/IR/Module.h" #include "llvm/Transforms/Instrumentation.h" +#include "llvm/Transforms/Instrumentation/MemorySanitizer.h" using namespace llvm; @@ -31,8 +32,8 @@ void LLVMAddThreadSanitizerPass(LLVMPassManagerRef PM) { unwrap(PM)->add(createThreadSanitizerPass()); } -void LLVMAddMemorySanitizerPass(LLVMPassManagerRef PM) { - unwrap(PM)->add(createMemorySanitizerPass()); +void LLVMAddMemorySanitizerLegacyPassPass(LLVMPassManagerRef PM) { + unwrap(PM)->add(createMemorySanitizerLegacyPassPass()); } void LLVMAddDataFlowSanitizerPass(LLVMPassManagerRef PM, diff --git a/llvm/bindings/go/llvm/InstrumentationBindings.h b/llvm/bindings/go/llvm/InstrumentationBindings.h index 97af2d58c27..5d448fc76d7 100644 --- a/llvm/bindings/go/llvm/InstrumentationBindings.h +++ b/llvm/bindings/go/llvm/InstrumentationBindings.h @@ -27,7 +27,7 @@ extern "C" { void LLVMAddAddressSanitizerFunctionPass(LLVMPassManagerRef PM); void LLVMAddAddressSanitizerModulePass(LLVMPassManagerRef PM); void LLVMAddThreadSanitizerPass(LLVMPassManagerRef PM); -void LLVMAddMemorySanitizerPass(LLVMPassManagerRef PM); +void LLVMAddMemorySanitizerLegacyPassPass(LLVMPassManagerRef PM); void LLVMAddDataFlowSanitizerPass(LLVMPassManagerRef PM, int ABIListFilesNum, const char **ABIListFiles); diff --git a/llvm/bindings/go/llvm/transforms_instrumentation.go b/llvm/bindings/go/llvm/transforms_instrumentation.go index 73e2732cbd9..73d093adad8 100644 --- a/llvm/bindings/go/llvm/transforms_instrumentation.go +++ b/llvm/bindings/go/llvm/transforms_instrumentation.go @@ -32,8 +32,8 @@ func (pm PassManager) AddThreadSanitizerPass() { C.LLVMAddThreadSanitizerPass(pm.C) } -func (pm PassManager) AddMemorySanitizerPass() { - C.LLVMAddMemorySanitizerPass(pm.C) +func (pm PassManager) AddMemorySanitizerLegacyPassPass() { + C.LLVMAddMemorySanitizerLegacyPassPass(pm.C) } func (pm PassManager) AddDataFlowSanitizerPass(abilist []string) { |