This is an archive of the discontinued LLVM Phabricator instance.

[tsan] Port TSan interceptors on OS X
ClosedPublic

Authored by kubamracek on Nov 2 2015, 7:46 AM.

Details

Summary

This patch modifies tsan_interceptors.cc to be buildable on OS X. Several of the intercepted methods are not available on OS X, so we need to #if !SANITIZER_MAC them. Plus a few other fixes, e.g. pthread_yield doesn't exist, let's use internal_sched_yield instead.

This is part of an effort to port TSan to OS X, and it's one the very first steps. Don't expect TSan on OS X to actually work or pass tests at this point.

Diff Detail

Repository
rL LLVM

Event Timeline

kubamracek updated this revision to Diff 38923.Nov 2 2015, 7:46 AM
kubamracek retitled this revision from to [tsan] Port TSan interceptors on OS X.
kubamracek updated this object.
kubamracek added reviewers: kcc, samsonov, glider, dvyukov.
glider edited edge metadata.Nov 2 2015, 10:52 AM

Dima, do you think we might want to move the Linux-specific interceptors into a separate file?

dvyukov edited edge metadata.Nov 3 2015, 4:00 AM

Dima, do you think we might want to move the Linux-specific interceptors into a separate file?

I am fine with having it all in a single file. The files will be huge anyway, so the only way of working with them is searching. Searching in a single file is simpler. E.g. where will you put pthread_spin_lock and how will you figure out where to search for it (it is linux and freebsd but not darwin, so not even "posix")?

dvyukov accepted this revision.Nov 3 2015, 4:09 AM
dvyukov edited edge metadata.

LGTM if you agree with the nitpicks

lib/tsan/rtl/tsan_interceptors.cc
337 ↗(On Diff #38923)

Please move it back.

716 ↗(On Diff #38923)

I think

#if SANITIZER_LINUX

will look move reasonable here now.

746 ↗(On Diff #38923)

same

768 ↗(On Diff #38923)

same here and below

This revision is now accepted and ready to land.Nov 3 2015, 4:09 AM
kubamracek updated this revision to Diff 39051.Nov 3 2015, 5:53 AM
kubamracek edited edge metadata.

Updating patch to address comments.

This revision was automatically updated to reflect the committed changes.