Don't initialize interceptor_metadata_map unless SI_POSIX is set

Differential revision: https://reviews.llvm.org/D64794

llvm-svn: 367188
This commit is contained in:
Eugene Leviant 2019-07-28 08:58:44 +00:00
parent e7bea9b73a
commit 45d910de99
1 changed files with 3 additions and 1 deletions

View File

@ -317,11 +317,11 @@ struct CommonInterceptorMetadata {
};
};
#if SI_POSIX
typedef AddrHashMap<CommonInterceptorMetadata, 31051> 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;