[msan] Conditionally disable new() and delete() wrappers.
To be used with static libstdc++.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@178866 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/msan/msan.cc b/lib/msan/msan.cc
index dd5e31b..dc11ed0 100644
--- a/lib/msan/msan.cc
+++ b/lib/msan/msan.cc
@@ -244,7 +244,8 @@
InitTlsSize();
InitializeInterceptors();
- ReplaceOperatorsNewAndDelete();
+ if (MSAN_REPLACE_OPERATORS_NEW_AND_DELETE)
+ ReplaceOperatorsNewAndDelete();
const char *msan_options = GetEnv("MSAN_OPTIONS");
InitializeFlags(&msan_flags, msan_options);
if (StackSizeIsUnlimited()) {
diff --git a/lib/msan/msan.h b/lib/msan/msan.h
index 1880b8e..90f30af 100644
--- a/lib/msan/msan.h
+++ b/lib/msan/msan.h
@@ -20,6 +20,10 @@
#include "msan_interface_internal.h"
#include "msan_flags.h"
+#ifndef MSAN_REPLACE_OPERATORS_NEW_AND_DELETE
+# define MSAN_REPLACE_OPERATORS_NEW_AND_DELETE 1
+#endif
+
#define MEM_TO_SHADOW(mem) (((uptr)mem) & ~0x400000000000ULL)
#define MEM_TO_ORIGIN(mem) (MEM_TO_SHADOW(mem) + 0x200000000000ULL)
#define MEM_IS_APP(mem) ((uptr)mem >= 0x600000000000ULL)