From ae21b4c5a36ab2e2ccd92bf89d768b4c09e7b7e0 Mon Sep 17 00:00:00 2001 From: Eugene Leviant Date: Sun, 28 Jul 2019 08:58:44 +0000 Subject: Don't initialize interceptor_metadata_map unless SI_POSIX is set Differential revision: https://reviews.llvm.org/D64794 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@367188 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/sanitizer_common/sanitizer_common_interceptors.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/sanitizer_common') diff --git a/lib/sanitizer_common/sanitizer_common_interceptors.inc b/lib/sanitizer_common/sanitizer_common_interceptors.inc index e805c8649..16bdffe4c 100644 --- a/lib/sanitizer_common/sanitizer_common_interceptors.inc +++ b/lib/sanitizer_common/sanitizer_common_interceptors.inc @@ -317,11 +317,11 @@ struct CommonInterceptorMetadata { }; }; +#if SI_POSIX typedef AddrHashMap MetadataHashMap; static MetadataHashMap *interceptor_metadata_map; -#if SI_POSIX UNUSED static void SetInterceptorMetadata(__sanitizer_FILE *addr, const FileMetadata &file) { MetadataHashMap::Handle h(interceptor_metadata_map, (uptr)addr); @@ -9551,9 +9551,11 @@ INTERCEPTOR(void, sl_free, void *sl, int freeall) { #endif static void InitializeCommonInterceptors() { +#if SI_POSIX static u64 metadata_mem[sizeof(MetadataHashMap) / sizeof(u64) + 1]; interceptor_metadata_map = new ((void *)&metadata_mem) MetadataHashMap(); // NOLINT +#endif INIT_MMAP; INIT_MMAP64; -- cgit v1.2.1