On Thu, Nov 22, 2012 at 02:08:07PM -0800, Wei Mi wrote: > Thanks. I checked in the code. > Committed revision 193736. > Committed revision 193737. > > Wei.
Wei, Unlike libasan, we seem to have issues building libtsan on darwin using the currently proposed patch... http://gcc.gnu.org/ml/gcc-patches/2012-11/msg01817.html The build fails at... libtool: compile: /sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/./gcc/g++ -B/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/./gcc/ -nostdinc++ -nostdinc++ -I/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin12.2.0/libstdc++-v3/include/x86_64-apple-darwin12.2.0 -I/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin12.2.0/libstdc++-v3/include -I/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121122/libstdc++-v3/libsupc++ -I/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121122/libstdc++-v3/include/backward -I/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20121122/libstdc++-v3/testsuite/util -L/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin12.2.0/libstdc++-v3/src -L/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/x86_64-apple-darwin12.2.0/libstdc++-v3/src/.libs -B/sw/lib/gcc4.8/x86_64-apple-darwin12.2.0/bin/ -B/sw/lib/gcc4.8/x86_64-apple-darwin12.2.0/lib/ -isystem /sw/lib/gcc4.8/x86_64-apple-darwin12.2.0/include -isystem /sw/lib/gcc4.8/x86_64-apple-darwin12.2.0/sys-include -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I. -I../../../../gcc-4.8-20121122/libsanitizer/tsan -I ../../../../gcc-4.8-20121122/libsanitizer -I ../../../../gcc-4.8-20121122/libsanitizer/include -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -Wno-c99-extensions -g -O2 -MT tsan_interceptors.lo -MD -MP -MF .deps/tsan_interceptors.Tpo -c ../../../../gcc-4.8-20121122/libsanitizer/tsan/tsan_interceptors.cc -fno-common -DPIC -o .libs/tsan_interceptors.o ../../../../gcc-4.8-20121122/libsanitizer/tsan/tsan_interceptors.cc: In function ‘unsigned int wrap_sleep(unsigned int)’: ../../../../gcc-4.8-20121122/libsanitizer/tsan/tsan_interceptors.cc:164:27: error: ‘sleep’ was not declared in this scope unsigned res = sleep(sec); ^ ../../../../gcc-4.8-20121122/libsanitizer/tsan/tsan_interceptors.cc: In function ‘int wrap_usleep(long_t)’: ../../../../gcc-4.8-20121122/libsanitizer/tsan/tsan_interceptors.cc:171:24: error: ‘usleep’ was not declared in this scope int res = usleep(usec); ^ ../../../../gcc-4.8-20121122/libsanitizer/tsan/tsan_interceptors.cc: In function ‘int wrap_nanosleep(void*, void*)’: ../../../../gcc-4.8-20121122/libsanitizer/tsan/tsan_interceptors.cc:178:31: error: ‘nanosleep’ was not declared in this scope int res = nanosleep(req, rem); ^ ../../../../gcc-4.8-20121122/libsanitizer/tsan/tsan_interceptors.cc: In function ‘void (* wrap_signal(int, sighandler_t))(int)’: ../../../../gcc-4.8-20121122/libsanitizer/tsan/tsan_interceptors.cc:1270:38: error: ‘sigaction’ was not declared in this scope int res = sigaction(sig, &act, &old); ^ In file included from ../../../../gcc-4.8-20121122/libsanitizer/interception/interception.h:184:0, from ../../../../gcc-4.8-20121122/libsanitizer/tsan/tsan_interceptors.h:15, from ../../../../gcc-4.8-20121122/libsanitizer/tsan/tsan_interceptors.cc:16: ../../../../gcc-4.8-20121122/libsanitizer/tsan/tsan_interceptors.cc: In function ‘void __tsan::InitializeInterceptors()’: ../../../../gcc-4.8-20121122/libsanitizer/tsan/tsan_interceptors.cc:1377:18: error: ‘longjmp’ was not declared in this scope TSAN_INTERCEPT(longjmp); ^ ../../../../gcc-4.8-20121122/libsanitizer/interception/interception_mac.h:41:35: note: in definition of macro ‘OVERRIDE_FUNCTION_MAC’ (::__interception::uptr)old_func, \ ^ ../../../../gcc-4.8-20121122/libsanitizer/interception/interception.h:187:35: note: in expansion of macro ‘INTERCEPT_FUNCTION_MAC’ # define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_MAC(func) ^ ../../../../gcc-4.8-20121122/libsanitizer/tsan/tsan_interceptors.h:48:30: note: in expansion of macro ‘INTERCEPT_FUNCTION’ #define TSAN_INTERCEPT(func) INTERCEPT_FUNCTION(func) ^ etc. Current llvm svn seems to be broken elsewhere (in compiler-rt/lib/ubsan) so I can't test tsan support there as well. Jack > > On Thu, Nov 22, 2012 at 1:54 AM, Jakub Jelinek <ja...@redhat.com> wrote: > > On Wed, Nov 21, 2012 at 11:22:51PM -0800, Wei Mi wrote: > >> I update the tsan patch against trunk, and create libtsan patch. > >> Please see if it is ok. > >> > >> gcc/ChangeLog: > >> 2012-11-22 Dmitry Vyukov <dvyu...@google.com> > >> Wei Mi <w...@google.com> > >> > >> * builtins.def (DEF_SANITIZER_BUILTIN): Define tsan builtins. > >> * sanitizer.def: Ditto. > >> * Makefile.in (tsan.o): Add tsan.o target. > >> (BUILTINS_DEF): Add sanitizer.def. > >> * passes.c (init_optimization_passes): Add tsan passes. > >> * tree-pass.h (register_pass_info): Ditto. > >> * toplev.c (compile_file): Ditto. > >> * doc/invoke.texi: Document tsan related options. > >> * gcc.c (LINK_COMMAND_SPEC): Add LIBTSAN_SPEC in link command > >> if -fsanitize=thread. > >> * tsan.c: New file about tsan. > >> * tsan.h: Ditto. > >> * common.opt: Add -fsanitize=thread. > >> > >> libsanitizer/ChangeLog: > >> 2012-11-22 Wei Mi <w...@google.com> > >> > >> * tsan: New directory. Import tsan runtime from llvm. > >> * configure.ac: Add 64 bits tsan build. > >> * Makefile.am: Likewise. > >> * configure: Regenerated. > >> * Makefile.in: Likewise. > > > > Ok, thanks. The comments can be fixed up incrementally. > > > > Jakub