summaryrefslogtreecommitdiffstats
path: root/compiler-rt
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2019-03-01 22:30:14 +0000
committerMartin Storsjo <martin@martin.st>2019-03-01 22:30:14 +0000
commit05394af3ffd91ceceabb5e28e47ab0976471b8df (patch)
tree33509d639d3cd953030838dba0571edae3f5705a /compiler-rt
parentd8632c92a718acf4def33035c9260384c1726824 (diff)
downloadbcm5719-llvm-05394af3ffd91ceceabb5e28e47ab0976471b8df.tar.gz
bcm5719-llvm-05394af3ffd91ceceabb5e28e47ab0976471b8df.zip
[sanitizers] Don't use Windows Trace Logging on MinGW
mingw-w64 currently is lacking the headers for this feature. Make the include lowercase at the same time. We consistently use lowercase for windows header includes, as windows itself is case insensitive, the SDK headers (in general, not necessarily considering this particular header) aren't consistent among themselves about what the proper canonical capitalization for headers are, and MinGW uses all lowercase names for the headers (as it is often used on case sensitive filesystems). In case mingw-w64 later gets this header, we can revert this (but keep the include lowercased). Differential Revision: https://reviews.llvm.org/D58765 llvm-svn: 355236
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_common.h10
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_win.cc8
2 files changed, 15 insertions, 3 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.h b/compiler-rt/lib/sanitizer_common/sanitizer_common.h
index d0e982fba92..fa7a1987106 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.h
@@ -804,7 +804,13 @@ enum AndroidApiLevel {
void WriteToSyslog(const char *buffer);
-#if SANITIZER_MAC || SANITIZER_WINDOWS
+#if defined(SANITIZER_WINDOWS) && defined(_MSC_VER)
+#define SANITIZER_WIN_TRACE 1
+#else
+#define SANITIZER_WIN_TRACE 0
+#endif
+
+#if SANITIZER_LINUX || SANITIZER_WIN_TRACE
void LogFullErrorReport(const char *buffer);
#else
INLINE void LogFullErrorReport(const char *buffer) {}
@@ -818,7 +824,7 @@ INLINE void WriteOneLineToSyslog(const char *s) {}
INLINE void LogMessageOnPrintf(const char *str) {}
#endif
-#if SANITIZER_LINUX || SANITIZER_WINDOWS
+#if SANITIZER_LINUX || SANITIZER_WIN_TRACE
// Initialize Android logging. Any writes before this are silently lost.
void AndroidLogInit();
void SetAbortMessage(const char *);
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_win.cc b/compiler-rt/lib/sanitizer_common/sanitizer_win.cc
index 95d3a3fccec..457cecb8cec 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_win.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_win.cc
@@ -20,7 +20,6 @@
#include <io.h>
#include <psapi.h>
#include <stdlib.h>
-#include <TraceLoggingProvider.h>
#include "sanitizer_common.h"
#include "sanitizer_file.h"
@@ -32,6 +31,8 @@
#if defined(PSAPI_VERSION) && PSAPI_VERSION == 1
#pragma comment(lib, "psapi")
#endif
+#if SANITIZER_WIN_TRACE
+#include <traceloggingprovider.h>
// Windows trace logging provider init
#pragma comment(lib, "advapi32.lib")
TRACELOGGING_DECLARE_PROVIDER(g_asan_provider);
@@ -39,6 +40,9 @@ TRACELOGGING_DECLARE_PROVIDER(g_asan_provider);
TRACELOGGING_DEFINE_PROVIDER(g_asan_provider, "AddressSanitizerLoggingProvider",
(0x6c6c766d, 0x3846, 0x4e6a, 0xa4, 0xfb, 0x5b,
0x53, 0x0b, 0xd0, 0xf3, 0xfa));
+#else
+#define TraceLoggingUnregister(x)
+#endif
// A macro to tell the compiler that this part of the code cannot be reached,
// if the compiler supports this feature. Since we're using this in
@@ -1080,6 +1084,7 @@ u32 GetNumberOfCPUs() {
return sysinfo.dwNumberOfProcessors;
}
+#if SANITIZER_WIN_TRACE
// TODO(mcgov): Rename this project-wide to PlatformLogInit
void AndroidLogInit(void) {
HRESULT hr = TraceLoggingRegister(g_asan_provider);
@@ -1103,6 +1108,7 @@ void LogFullErrorReport(const char *buffer) {
TraceLoggingValue(buffer, "AsanReportContents"));
}
}
+#endif // SANITIZER_WIN_TRACE
} // namespace __sanitizer
OpenPOWER on IntegriCloud