Page MenuHomePhabricator

[TSan][libdispatch] Remove dependency on system headers
ClosedPublic

Authored by yln on Fri, Mar 8, 11:40 AM.

Details

Summary

Including <dispatch/dispatch.h> and <Blocks.h> transitively pulls in
other system headers. Let's try to avoid that.

Blocks.h: compiler-rt already includes a blocks runtime. Just use the
header file that comes with it.

dispatch.h: Declare the bare minimum required for our implementation,
i.e., everything needed to define the interceptors, but not the
interceptors themselves. See tsan_dispatch_defs.h. I spotted a few other
places in compile-rt, where we declare libdispatch types. Maybe this
file can be moved to sanitizer_common if we deem it useful enough.

tsan_libdispatch.cc now compiles on Linux/Clang (requires support for
-fblocks). Linking still requires some manual configuration.

Diff Detail

Repository
rL LLVM

Event Timeline

yln created this revision.Fri, Mar 8, 11:40 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptFri, Mar 8, 11:40 AM
Herald added subscribers: llvm-commits, Restricted Project, jdoerfert, kubamracek. · View Herald Transcript
kubamracek accepted this revision.Thu, Mar 14, 1:10 PM

Looks good, with a nit (feel free to address it separately).

compiler-rt/lib/tsan/rtl/tsan_dispatch_defs.h
53–56 ↗(On Diff #189896)

Can we just unconditionally define DISPATCH_NOESCAPE now that we don't include the system header?

This revision is now accepted and ready to land.Thu, Mar 14, 1:10 PM
yln marked 2 inline comments as done.Thu, Mar 14, 1:22 PM
yln added inline comments.
compiler-rt/lib/tsan/rtl/tsan_dispatch_defs.h
53–56 ↗(On Diff #189896)
This revision was automatically updated to reflect the committed changes.
yln marked an inline comment as done.