Index: lib/tsan/rtl/tsan_interceptors.cc =================================================================== --- lib/tsan/rtl/tsan_interceptors.cc +++ lib/tsan/rtl/tsan_interceptors.cc @@ -160,6 +160,9 @@ #if SANITIZER_FREEBSD int sa_flags; __sanitizer_sigset_t sa_mask; +#elif SANITIZER_MAC + __sanitizer_sigset_t sa_mask; + int sa_flags; #else __sanitizer_sigset_t sa_mask; #ifndef __mips__ @@ -172,7 +175,7 @@ const sighandler_t SIG_DFL = (sighandler_t)0; const sighandler_t SIG_IGN = (sighandler_t)1; const sighandler_t SIG_ERR = (sighandler_t)-1; -#if SANITIZER_FREEBSD +#if SANITIZER_FREEBSD || SANITIZER_MAC const int SA_SIGINFO = 0x40; const int SIG_SETMASK = 3; #elif defined(__mips__) @@ -2033,7 +2036,7 @@ sigactions[sig].sa_flags = *(volatile int*)&act->sa_flags; internal_memcpy(&sigactions[sig].sa_mask, &act->sa_mask, sizeof(sigactions[sig].sa_mask)); -#if !SANITIZER_FREEBSD +#if !SANITIZER_FREEBSD && !SANITIZER_MAC sigactions[sig].sa_restorer = act->sa_restorer; #endif sigaction_t newact; Index: lib/tsan/rtl/tsan_rtl_amd64.S =================================================================== --- lib/tsan/rtl/tsan_rtl_amd64.S +++ lib/tsan/rtl/tsan_rtl_amd64.S @@ -300,7 +300,7 @@ movq _ZN14__interception14real_sigsetjmpE@GOTPCREL(%rip), %rdx jmp *(%rdx) #else - jmp ASM_TSAN_SYMBOL(setjmp) + jmp ASM_TSAN_SYMBOL(sigsetjmp) #endif CFI_ENDPROC ASM_SIZE(ASM_TSAN_SYMBOL_INTERCEPTOR(sigsetjmp)) Index: test/tsan/signal_longjmp.cc =================================================================== --- test/tsan/signal_longjmp.cc +++ test/tsan/signal_longjmp.cc @@ -12,6 +12,12 @@ #include #include +#ifdef __APPLE__ +#define SIGNAL_TO_HANDLE SIGBUS +#else +#define SIGNAL_TO_HANDLE SIGSEGV +#endif + sigjmp_buf fault_jmp; volatile int fault_expected; @@ -44,7 +50,7 @@ exit(1); } - if (sigaction(SIGSEGV, &act, NULL)) { + if (sigaction(SIGNAL_TO_HANDLE, &act, NULL)) { perror("sigaction"); exit(1); }