Skip to content

Commit ddac04c

Browse files
Merge pull request #6973 from usama54321/fix-build-id-length-on-darwin
[Sanitizers] UUID/Build ID is 16 bytes on Darwin.
2 parents 175d9c0 + ba3b6ad commit ddac04c

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,11 @@ inline const char *ModuleArchToString(ModuleArch arch) {
790790
return "";
791791
}
792792

793+
#if SANITIZER_APPLE
794+
const uptr kModuleUUIDSize = 16;
795+
#else
793796
const uptr kModuleUUIDSize = 32;
797+
#endif
794798
const uptr kMaxSegName = 16;
795799

796800
// Represents a binary loaded into virtual memory (e.g. this can be an

compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ set(SANITIZER_UNITTESTS
2929
sanitizer_list_test.cpp
3030
sanitizer_lzw_test.cpp
3131
sanitizer_mac_test.cpp
32+
sanitizer_module_uuid_size.cpp
3233
sanitizer_mutex_test.cpp
3334
sanitizer_nolibc_test.cpp
3435
sanitizer_posix_test.cpp
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include "sanitizer_common/sanitizer_common.h"
2+
#include "gtest/gtest.h"
3+
4+
TEST(ModuleUUID, kModuleUUIDSize) {
5+
#if SANITIZER_APPLE
6+
EXPECT_EQ(__sanitizer::kModuleUUIDSize, 16ULL);
7+
#else
8+
EXPECT_EQ(__sanitizer::kModuleUUIDSize, 32ULL);
9+
#endif
10+
}

0 commit comments

Comments
 (0)