[compiler-rt] [sanitizer_common] [Darwin] Fix strncmp => internal_strncmp in NextSegmentLoad (PR #166972)

Andrew Haberlandt via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 7 09:57:30 PST 2025


https://github.com/ndrewh updated https://github.com/llvm/llvm-project/pull/166972

>From b2c8d4c6215d6c6654c792d80789616643f2b4a9 Mon Sep 17 00:00:00 2001
From: Andrew Haberlandt <ahaberlandt at apple.com>
Date: Fri, 7 Nov 2025 08:47:44 -0800
Subject: [PATCH 1/2] [sanitizer_common] [Darwin] Fix strncmp =>
 internal_strncmp in NextSegmentLoad

---
 compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cpp
index 72f4bbf212f9a..e5008041bbb59 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cpp
@@ -305,7 +305,7 @@ static bool NextSegmentLoad(MemoryMappedSegment *segment,
   layout_data->current_load_cmd_count--;
   if (((const load_command *)lc)->cmd == kLCSegment) {
     const SegmentCommand* sc = (const SegmentCommand *)lc;
-    if (strncmp(sc->segname, "__LINKEDIT", sizeof("__LINKEDIT")) == 0) {
+    if (internal_strncmp(sc->segname, "__LINKEDIT", sizeof("__LINKEDIT")) == 0) {
       // The LINKEDIT sections are for internal linker use, and may alias
       // with the LINKEDIT section for other modules. (If we included them,
       // our memory map would contain overlappping sections.)

>From a1f3fad8c01d9b1d57e306cdadbf2329e1cad06d Mon Sep 17 00:00:00 2001
From: Andrew Haberlandt <ahaberlandt at apple.com>
Date: Fri, 7 Nov 2025 09:57:18 -0800
Subject: [PATCH 2/2] absolutely BEAUTIFUL clang-format

---
 compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cpp
index e5008041bbb59..9e9e3f25608d9 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cpp
@@ -305,7 +305,8 @@ static bool NextSegmentLoad(MemoryMappedSegment *segment,
   layout_data->current_load_cmd_count--;
   if (((const load_command *)lc)->cmd == kLCSegment) {
     const SegmentCommand* sc = (const SegmentCommand *)lc;
-    if (internal_strncmp(sc->segname, "__LINKEDIT", sizeof("__LINKEDIT")) == 0) {
+    if (internal_strncmp(sc->segname, "__LINKEDIT", sizeof("__LINKEDIT")) ==
+        0) {
       // The LINKEDIT sections are for internal linker use, and may alias
       // with the LINKEDIT section for other modules. (If we included them,
       // our memory map would contain overlappping sections.)



More information about the llvm-commits mailing list