[asan] Fix Darwin runtimes compilation
authorShoaib Meenai <smeenai@fb.com>
Sat, 1 Apr 2023 09:22:17 +0000 (02:22 -0700)
committerShoaib Meenai <smeenai@fb.com>
Sat, 1 Apr 2023 09:22:17 +0000 (02:22 -0700)
It was failing because of size_t being unknown. I was going to just pull
in stddef.h, but the callback using size_t is only used for Linux and
NetBSD, so limit its definition to those platforms as well.

compiler-rt/lib/asan/asan_memory_profile.cpp

index c7e3d7b..f41d8e1 100644 (file)
@@ -128,12 +128,14 @@ static void LockDefStuffAndStopTheWorld(DoStopTheWorldParam *param) {
   __lsan::UnlockThreadRegistry();
 }
 
+#if SANITIZER_LINUX || SANITIZER_NETBSD
 static int LockStuffAndStopTheWorldCallback(struct dl_phdr_info *info,
                                             size_t size, void *data) {
   DoStopTheWorldParam *param = reinterpret_cast<DoStopTheWorldParam *>(data);
   LockDefStuffAndStopTheWorld(param);
   return 1;
 }
+#endif
 
 static void LockStuffAndStopTheWorld(StopTheWorldCallback callback,
                                      void *argument) {