sanitizer_tls_get_addr.cpp is currently part of SANITIZER_SOURCES_NOTERMINATION, which means it gets compiled into nearly everything, even if it isn’t actually needed. This is problematic when we try to change sanitizer_tls_get_addr() to call internal allocator functions (e.g., __sanitizer_get_allocated_begin() in https://reviews.llvm.org/D147459), because some targets (dyndd, ubsan, MemProfUnitTests) do not have an allocator.
To avoid the need for weak annotations for the internal allocator functions, this patch moves sanitizer_tls_get_addr() into its own library, and updates the CMakeLists to add the library only if needed.