This is an archive of the discontinued LLVM Phabricator instance.

[tsan] Support interception of libdispatch on Linux
ClosedPublic

Authored by yln on Mar 4 2019, 4:34 PM.

Details

Summary

This is a new attempt for bringing TSan libdispatch support to Linux.
The main issue with the last patch (https://reviews.llvm.org/D53171) was
that we want to avoid building a separate library.

The updated plan is as follows:

  1. Hide libdispatch support behind a flag: true on Darwin, false elsewhere. If flag is specified, assume that libdispatch header and -flbocks is available for building. This way we can directly include the libdispatch header and rely on blocks runtime for our implementation.
  2. Optionally/weakly intercept libdispatch API functions.

This patch accomplishes 1). It compiles (without the flag enabled) on
Linux. Follow-up patches will provide 2) and enabling of tests on Linux.

Diff Detail

Repository
rL LLVM

Event Timeline

yln created this revision.Mar 4 2019, 4:34 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 4 2019, 4:34 PM
Herald added subscribers: llvm-commits, Restricted Project, jdoerfert and 2 others. · View Herald Transcript

I don't mind merging this, but what's the usage/test story here? There are 30+ tests in test/Darwin/gcd-* but they don't run on linux.
Do you intend to do some further development of this support? I just afraid that most users won't be able to use it because it's not enabled, and the ones that will build own compiler will find it broken.

yln added a comment.Mar 5 2019, 10:48 AM

Do you intend to do some further development of this support?

Yes!

From revision summary:

This patch accomplishes 1). It compiles (without the flag enabled) on
Linux. Follow-up patches will provide 2) and enabling of tests on Linux.

dvyukov accepted this revision.Mar 6 2019, 2:23 AM

I should have read it better!

This revision is now accepted and ready to land.Mar 6 2019, 2:23 AM
This revision was automatically updated to reflect the committed changes.
compiler-rt/trunk/lib/tsan/rtl/tsan_libdispatch.cc