diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.h b/compiler-rt/lib/sanitizer_common/sanitizer_common.h --- a/compiler-rt/lib/sanitizer_common/sanitizer_common.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.h @@ -790,7 +790,11 @@ return ""; } +#ifdef SANITIZER_APPLE +const uptr kModuleUUIDSize = 16; +#else const uptr kModuleUUIDSize = 32; +#endif const uptr kMaxSegName = 16; // Represents a binary loaded into virtual memory (e.g. this can be an diff --git a/compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt b/compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt --- a/compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt +++ b/compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt @@ -29,6 +29,7 @@ sanitizer_list_test.cpp sanitizer_lzw_test.cpp sanitizer_mac_test.cpp + sanitizer_module_uuid_size.cpp sanitizer_mutex_test.cpp sanitizer_nolibc_test.cpp sanitizer_posix_test.cpp diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_module_uuid_size.cpp b/compiler-rt/lib/sanitizer_common/tests/sanitizer_module_uuid_size.cpp new file mode 100644 --- /dev/null +++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_module_uuid_size.cpp @@ -0,0 +1,10 @@ +#include "sanitizer_common/sanitizer_common.h" +#include "gtest/gtest.h" + +TEST(ModuleUUID, kModuleUUIDSize) { +#ifdef SANITIZER_APPLE + EXPECT_EQ(__sanitizer::kModuleUUIDSize, 16ULL); +#else + EXPECT_EQ(__sanitizer::kModuleUUIDSize, 32ULL); +#endif +}