[GWP-ASan] Add mutexes for Fuchsia
authorKostya Kortchinsky <kostyak@google.com>
Wed, 28 Oct 2020 23:04:02 +0000 (16:04 -0700)
committerKostya Kortchinsky <kostyak@google.com>
Thu, 29 Oct 2020 22:51:13 +0000 (15:51 -0700)
commit3591721ada99810aeddfa3d4c83eea0dbeed7f18
treef9752b0fc2fd52892bb0e0628e2d5faf70433a50
parenteaee608448c832e8f806faae30ae4100620c4688
[GWP-ASan] Add mutexes for Fuchsia

Mitch expressed a preference to not have `#ifdef`s in platform agnostic
code, this change tries to accomodate this.

I am not attached to the method this CL proposes, so if anyone has a
suggestion, I am open.

We move the platform specific member of the mutex into its own platform
specific class that the main `Mutex` class inherits from. Functions are
implemented in their respective platform specific compilation units.

For Fuchsia, we use the sync APIs, as those are also the ones being
used in Scudo.

Differential Revision: https://reviews.llvm.org/D90351
compiler-rt/lib/gwp_asan/CMakeLists.txt
compiler-rt/lib/gwp_asan/mutex.h
compiler-rt/lib/gwp_asan/platform_specific/mutex_fuchsia.cpp [new file with mode: 0644]
compiler-rt/lib/gwp_asan/platform_specific/mutex_fuchsia.h [new file with mode: 0644]
compiler-rt/lib/gwp_asan/platform_specific/mutex_posix.h [new file with mode: 0644]