Skip to content

lsan: fix macos build after #144604 #144818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jcking
Copy link
Contributor

@jcking jcking commented Jun 19, 2025

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Jun 19, 2025

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Justin King (jcking)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/144818.diff

1 Files Affected:

  • (modified) compiler-rt/lib/lsan/lsan_interceptors.cpp (+29-29)
diff --git a/compiler-rt/lib/lsan/lsan_interceptors.cpp b/compiler-rt/lib/lsan/lsan_interceptors.cpp
index 6da9d0d9d24f8..ea6f739d66422 100644
--- a/compiler-rt/lib/lsan/lsan_interceptors.cpp
+++ b/compiler-rt/lib/lsan/lsan_interceptors.cpp
@@ -84,35 +84,6 @@ INTERCEPTOR(void, free, void *p) {
   lsan_free(p);
 }
 
-#  if SANITIZER_INTERCEPT_FREE_SIZED
-INTERCEPTOR(void, free_sized, void *p, uptr size) {
-  if (UNLIKELY(!p))
-    return;
-  if (DlsymAlloc::PointerIsMine(p))
-    return DlsymAlloc::Free(p);
-  ENSURE_LSAN_INITED;
-  lsan_free_sized(p, size);
-}
-#    define LSAN_MAYBE_INTERCEPT_FREE_SIZED INTERCEPT_FUNCTION(free_sized)
-#  else
-#    define LSAN_MAYBE_INTERCEPT_FREE_SIZED
-#  endif
-
-#  if SANITIZER_INTERCEPT_FREE_ALIGNED_SIZED
-INTERCEPTOR(void, free_aligned_sized, void *p, uptr alignment, uptr size) {
-  if (UNLIKELY(!p))
-    return;
-  if (DlsymAlloc::PointerIsMine(p))
-    return DlsymAlloc::Free(p);
-  ENSURE_LSAN_INITED;
-  lsan_free_aligned_sized(p, alignment, size);
-}
-#    define LSAN_MAYBE_INTERCEPT_FREE_ALIGNED_SIZED \
-      INTERCEPT_FUNCTION(free_aligned_sized)
-#  else
-#    define LSAN_MAYBE_INTERCEPT_FREE_ALIGNED_SIZED
-#  endif
-
 INTERCEPTOR(void*, calloc, uptr nmemb, uptr size) {
   if (DlsymAlloc::Use())
     return DlsymAlloc::Callocate(nmemb, size);
@@ -148,6 +119,35 @@ INTERCEPTOR(void*, valloc, uptr size) {
 }
 #endif  // !SANITIZER_APPLE
 
+#  if SANITIZER_INTERCEPT_FREE_SIZED
+INTERCEPTOR(void, free_sized, void *p, uptr size) {
+  if (UNLIKELY(!p))
+    return;
+  if (DlsymAlloc::PointerIsMine(p))
+    return DlsymAlloc::Free(p);
+  ENSURE_LSAN_INITED;
+  lsan_free_sized(p, size);
+}
+#    define LSAN_MAYBE_INTERCEPT_FREE_SIZED INTERCEPT_FUNCTION(free_sized)
+#  else
+#    define LSAN_MAYBE_INTERCEPT_FREE_SIZED
+#  endif
+
+#  if SANITIZER_INTERCEPT_FREE_ALIGNED_SIZED
+INTERCEPTOR(void, free_aligned_sized, void *p, uptr alignment, uptr size) {
+  if (UNLIKELY(!p))
+    return;
+  if (DlsymAlloc::PointerIsMine(p))
+    return DlsymAlloc::Free(p);
+  ENSURE_LSAN_INITED;
+  lsan_free_aligned_sized(p, alignment, size);
+}
+#    define LSAN_MAYBE_INTERCEPT_FREE_ALIGNED_SIZED \
+      INTERCEPT_FUNCTION(free_aligned_sized)
+#  else
+#    define LSAN_MAYBE_INTERCEPT_FREE_ALIGNED_SIZED
+#  endif
+
 #if SANITIZER_INTERCEPT_MEMALIGN
 INTERCEPTOR(void*, memalign, uptr alignment, uptr size) {
   ENSURE_LSAN_INITED;

@jcking
Copy link
Contributor Author

jcking commented Jun 19, 2025

@vitalybuka

@jcking jcking force-pushed the lsan_free_aligned_sized_v2 branch from c808a33 to f5611ac Compare June 19, 2025 01:09
Signed-off-by: Justin King <jcking@google.com>
@jcking jcking force-pushed the lsan_free_aligned_sized_v2 branch from f5611ac to 549f931 Compare June 19, 2025 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants