[GWP-ASan] Abstract the thread local variables access
authorKostya Kortchinsky <kostyak@google.com>
Mon, 26 Oct 2020 21:54:22 +0000 (14:54 -0700)
committerKostya Kortchinsky <kostyak@google.com>
Wed, 28 Oct 2020 22:06:38 +0000 (15:06 -0700)
commit90678f65ae47523586bd34392ed3cd1369cf5e9b
tree87427684f86733c9718660daffa8a02233bbf290
parent5b91a6a88bd681f63702116f4a7f28976f4fa848
[GWP-ASan] Abstract the thread local variables access

In a similar fashion to D87420 for Scudo, this CL introduces a way to
get thread local variables via a platform-specific reserved TLS slot,
since Fuchsia doesn't support ELF TLS from the libc itself.

If needing to use this, a platform will have to define
`GWP_ASAN_HAS_PLATFORM_TLS_SLOT` and provide `gwp_asan_platform_tls_slot.h`
which will define a `uint64_t *getPlatformGwpAsanTlsSlot()` function
that will return the TLS word of storage.

I snuck in a couple of cleanup items as well, moving some static
functions to anonymous namespace for consistency.

Differential Revision: https://reviews.llvm.org/D90195
compiler-rt/lib/gwp_asan/CMakeLists.txt
compiler-rt/lib/gwp_asan/guarded_pool_allocator.cpp
compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
compiler-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_posix.cpp
compiler-rt/lib/gwp_asan/platform_specific/guarded_pool_allocator_tls.h [new file with mode: 0644]
compiler-rt/lib/gwp_asan/platform_specific/utilities_posix.cpp
compiler-rt/lib/gwp_asan/utilities.cpp