Index: compiler-rt/lib/asan/asan_posix.cc =================================================================== --- compiler-rt/lib/asan/asan_posix.cc +++ compiler-rt/lib/asan/asan_posix.cc @@ -35,11 +35,7 @@ void AsanOnDeadlySignal(int signo, void *siginfo, void *context) { ScopedDeadlySignal signal_scope(GetCurrentThread()); - // Write the first message using fd=2, just in case. - // It may actually fail to write in case stderr is closed. - internal_write(2, SanitizerToolName, internal_strlen(SanitizerToolName)); - static const char kDeadlySignal[] = ":DEADLYSIGNAL\n"; - internal_write(2, kDeadlySignal, sizeof(kDeadlySignal) - 1); + StartReportDeadlySignal(); SignalContext sig = SignalContext::Create(siginfo, context); if (IsStackOverflow(((siginfo_t *)siginfo)->si_code, sig)) ReportStackOverflow(sig); Index: compiler-rt/lib/sanitizer_common/sanitizer_common.h =================================================================== --- compiler-rt/lib/sanitizer_common/sanitizer_common.h +++ compiler-rt/lib/sanitizer_common/sanitizer_common.h @@ -308,9 +308,11 @@ // Functions related to signal handling. typedef void (*SignalHandlerType)(int, void *, void *); HandleSignalMode GetHandleSignalMode(int signum); -bool IsStackOverflow(int code, const SignalContext &sig); void InstallDeadlySignalHandlers(SignalHandlerType handler); const char *DescribeSignalOrException(int signo); +// Signal reporting. +void StartReportDeadlySignal(); +bool IsStackOverflow(int code, const SignalContext &sig); // Alternative signal stack (POSIX-only). void SetAlternateSignalStack(); void UnsetAlternateSignalStack(); Index: compiler-rt/lib/sanitizer_common/sanitizer_posix.cc =================================================================== --- compiler-rt/lib/sanitizer_common/sanitizer_posix.cc +++ compiler-rt/lib/sanitizer_common/sanitizer_posix.cc @@ -322,6 +322,7 @@ } #if !SANITIZER_GO + bool IsStackOverflow(int code, const SignalContext &sig) { // Access at a reasonable offset above SP, or slightly below it (to account // for x86_64 or PowerPC redzone, ARM push of multiple registers, etc) is @@ -366,8 +367,17 @@ // unaligned memory access. return IsStackAccess && (code == si_SEGV_MAPERR || code == si_SEGV_ACCERR); } + #endif //! SANITIZER_GO +void StartReportDeadlySignal() { + // Write the first message using fd=2, just in case. + // It may actually fail to write in case stderr is closed. + internal_write(2, SanitizerToolName, internal_strlen(SanitizerToolName)); + static const char kDeadlySignal[] = ":DEADLYSIGNAL\n"; + internal_write(2, kDeadlySignal, sizeof(kDeadlySignal) - 1); +} + } // namespace __sanitizer #endif // SANITIZER_POSIX Index: compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc =================================================================== --- compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc +++ compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc @@ -215,6 +215,7 @@ MaybeInstallSigaction(SIGFPE, handler); MaybeInstallSigaction(SIGILL, handler); } + #endif // SANITIZER_GO bool IsAccessibleMemoryRange(uptr beg, uptr size) {