[Sanitizer] Fix OnPrint weak hook. Disable weak hooks for gotsan.

llvm-svn: 178640
This commit is contained in:
Alexey Samsonov 2013-04-03 13:22:54 +00:00
parent 92e26646bc
commit 87c2a87b50
2 changed files with 7 additions and 7 deletions

View File

@ -27,7 +27,7 @@
# define SANITIZER_WEAK_ATTRIBUTE __attribute__((weak))
#endif
#if SANITIZER_LINUX
#if SANITIZER_LINUX && !defined(SANITIZER_GO)
# define SANITIZER_SUPPORTS_WEAK_HOOKS 1
#else
# define SANITIZER_SUPPORTS_WEAK_HOOKS 0

View File

@ -173,16 +173,16 @@ void SetPrintfAndReportCallback(void (*callback)(const char *)) {
PrintfAndReportCallback = callback;
}
#if SANITIZER_SUPPORTS_WEAK_HOOKS
// Can be overriden in frontend.
#ifndef SANITIZER_SUPPORTS_WEAK_HOOKS
SANITIZER_INTERFACE_ATTRIBUTE void WEAK OnPrint(const char *str) {
(void)str;
}
SANITIZER_WEAK_ATTRIBUTE SANITIZER_INTERFACE_ATTRIBUTE
void OnPrint(const char *str);
#endif
static void CallPrintfAndReportCallback(const char *str) {
#ifndef SANITIZER_SUPPORTS_WEAK_HOOKS
OnPrint(str);
#if SANITIZER_SUPPORTS_WEAK_HOOKS
if (&OnPrint != NULL)
OnPrint(str);
#endif
if (PrintfAndReportCallback)
PrintfAndReportCallback(str);