This is an archive of the discontinued LLVM Phabricator instance.

[tsan] Fix pthread_once interceptor for OS X
ClosedPublic

Authored by kubamracek on Nov 5 2015, 3:28 AM.

Details

Summary

TSan has a re-implementation of pthread_once in its interceptor, which assumes that the pthread_once_t *once_control pointer is actually pointing to a "storage" which is zero-initialized and used for the atomic operations. However, that's not true on OS X, where pthread_once_t is a structure, that contains a header (with a magic value) and the actual storage follows after that. This patch skips the header to make the interceptor work on OS X.

Diff Detail

Event Timeline

kubamracek updated this revision to Diff 39337.Nov 5 2015, 3:28 AM
kubamracek retitled this revision from to [tsan] Fix pthread_once interceptor for OS X.
kubamracek updated this object.
kubamracek added reviewers: kcc, dvyukov, glider, samsonov.
dvyukov accepted this revision.Nov 5 2015, 3:44 AM
dvyukov edited edge metadata.
This revision is now accepted and ready to land.Nov 5 2015, 3:44 AM
This revision was automatically updated to reflect the committed changes.