tsan: fix handling of setjmp

It's incorrect to take address of setjmp,
because it may not (ligally) present in libc.
Fixes http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59188

llvm-svn: 195345
This commit is contained in:
Dmitry Vyukov 2013-11-21 11:48:29 +00:00
parent cf7f6db300
commit 4ca8ee692e
1 changed files with 8 additions and 4 deletions

View File

@ -2048,10 +2048,14 @@ void InitializeInterceptors() {
SANITIZER_COMMON_INTERCEPTORS_INIT;
TSAN_INTERCEPT(setjmp);
TSAN_INTERCEPT(_setjmp);
TSAN_INTERCEPT(sigsetjmp);
TSAN_INTERCEPT(__sigsetjmp);
// We can not use TSAN_INTERCEPT to get setjmp addr,
// because it does &setjmp and setjmp is not present in some versions of libc.
using __interception::GetRealFunctionAddress;
GetRealFunctionAddress("setjmp", (uptr*)&REAL(setjmp), 0, 0);
GetRealFunctionAddress("_setjmp", (uptr*)&REAL(_setjmp), 0, 0);
GetRealFunctionAddress("sigsetjmp", (uptr*)&REAL(sigsetjmp), 0, 0);
GetRealFunctionAddress("__sigsetjmp", (uptr*)&REAL(__sigsetjmp), 0, 0);
TSAN_INTERCEPT(longjmp);
TSAN_INTERCEPT(siglongjmp);