[PATCH] D53171: [tsan] Bring Dispatch support to Linux

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 29 04:50:53 PDT 2018


dvyukov added a comment.

In https://reviews.llvm.org/D53171#1271412, @kubamracek wrote:

> In https://reviews.llvm.org/D53171#1263122, @dvyukov wrote:
>
> > Is it possible to make it just part of tsan without introducing a separate static library? That would be more scalable and easier to use.
> >
> > We already doing something similar in tsan_interceptors.cc. For example, we intercept some libc++ functions, but end user may not link in libc++ and it will all work because interceptors do dynamic dispatch and don't fail if a function is not resolved.
> >  This would require calling all dispatch functions as REAL(dispatch_foo), but otherwise should work.
>
>
> The real problem here is -fblocks, which needs -lBlocksRuntime, and this dependency is implicitly generated by the compiler and I don't think there's a way to make it a weak dependency. I also don't want to rewrite this file to not use blocks as that's going to make everything much less readable. I'm open to suggestions, of course.
>
> Don't we already have a separate clang_rt.tsan_cxx static library? I thought that's here specifically to break up the dependencies.


I don't know/remember why we have clang_rt.tsan_cxx. But we have __cxa_guard_acquire interceptor in tsan_interceptors.cc so we handle optionally linked libc++ without that. And I hope that we at least link in clang_rt.tsan_cxx transparently for users.

Can we simply enable -lBlocksRuntime always with tsan? We already do this for -lrt -lpthread.


https://reviews.llvm.org/D53171





More information about the llvm-commits mailing list