forked from OSchip/llvm-project
[Sanitizer] Fix OnPrint weak hook. Disable weak hooks for gotsan.
llvm-svn: 178640
This commit is contained in:
parent
92e26646bc
commit
87c2a87b50
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue