[compiler-rt] r178640 - [Sanitizer] Fix OnPrint weak hook. Disable weak hooks for gotsan.
Alexey Samsonov
samsonov at google.com
Wed Apr 3 06:22:54 PDT 2013
Author: samsonov
Date: Wed Apr 3 08:22:54 2013
New Revision: 178640
URL: http://llvm.org/viewvc/llvm-project?rev=178640&view=rev
Log:
[Sanitizer] Fix OnPrint weak hook. Disable weak hooks for gotsan.
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h?rev=178640&r1=178639&r2=178640&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h Wed Apr 3 08:22:54 2013
@@ -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
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc?rev=178640&r1=178639&r2=178640&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc Wed Apr 3 08:22:54 2013
@@ -173,16 +173,16 @@ void SetPrintfAndReportCallback(void (*c
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);
More information about the llvm-commits
mailing list