]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Darwin: clean up use of Z-encoded libc component libraries in vg_replace_strmem.c
authorPaul Floyd <pjfloyd@wanadoo.fr>
Tue, 4 Nov 2025 07:27:01 +0000 (08:27 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Tue, 4 Nov 2025 07:30:57 +0000 (08:30 +0100)
Use macros, mainly for consistency. Not sure how these have evolved post OSX 10.13.

include/pub_tool_redir.h
shared/vg_replace_strmem.c

index c19fd3d97e662f45ccb2eb939d277aa9eb270d93..043f8ac52016610594d1edc678240aba74050c4f 100644 (file)
 #else
 #  define  VG_Z_LIBC_SONAME  libcZdsoZa              // libc.so*
 #endif
-#elif defined(VGO_darwin) && (DARWIN_VERS <= DARWIN_10_6)
-#  define  VG_Z_LIBC_SONAME  libSystemZdZaZddylib    // libSystem.*.dylib
+#elif defined(VGO_darwin)
 
-#elif defined(VGO_darwin) && (DARWIN_VERS == DARWIN_10_7 \
-                              || DARWIN_VERS == DARWIN_10_8)
+#if (DARWIN_VERS <= DARWIN_10_6)
+#  define  VG_Z_LIBC_SONAME  libSystemZdZaZddylib    // libSystem.*.dylib
+#elif (DARWIN_VERS == DARWIN_10_7 || DARWIN_VERS == DARWIN_10_8)
 #  define  VG_Z_LIBC_SONAME  libsystemZucZaZddylib   // libsystem_c*.dylib
    /* Note that the idea of a single name for the C library falls
       apart on more recent Darwins (10.8 and later) since the
       libsystem_platform.dylib.  This makes VG_Z_LIBC_SONAME somewhat useless
       at least inside vg_replace_strmem.c, and that hardwires some dylib
       names directly, for OSX 10.9. */
-
-#elif defined(VGO_darwin) && (DARWIN_VERS >= DARWIN_10_9)
+#elif (DARWIN_VERS >= DARWIN_10_9)
 #  define  VG_Z_LIBC_SONAME  libsystemZumallocZddylib  // libsystem_malloc.dylib
+#endif
+
+/* Not tested on systems older than OSX 10.13 */
+#define VG_Z_LIBSYSTEM_C_SONAME libsystemZucZddylib
+#define VG_Z_LIBSYSTEM_PLATFORM_SONAME libsystemZuplatformZddylib
 
 #else
 #  error "Unknown platform"
-
 #endif
 
 /* --- Sonames of the GNU C++ library. --- */
index 28fda80ee2ad2f7c4112cfe908d0178ccde3a646..5ef4884efa07d12ca418d8f78e27e86271d92b7f 100644 (file)
@@ -237,7 +237,7 @@ static inline void my_exit ( int x )
  //STRRCHR(VG_Z_DYLD,          rindex)
  STRRCHR(VG_Z_LIBC_SONAME, strrchr)
 # if DARWIN_VERS >= DARWIN_10_9
-  STRRCHR(libsystemZucZddylib, strrchr)
+  STRRCHR(VG_Z_LIBSYSTEM_C_SONAME, strrchr)
 # endif
 
 #elif defined(VGO_solaris)
@@ -290,15 +290,15 @@ static inline void my_exit ( int x )
 #elif defined(VGO_darwin)
  STRCHR(VG_Z_LIBC_SONAME, strchr)
 # if DARWIN_VERS == DARWIN_10_9
-  STRCHR(libsystemZuplatformZddylib, _platform_strchr)
+  STRCHR(VG_Z_LIBSYSTEM_PLATFORM_SONAME, _platform_strchr)
 # endif
 # if DARWIN_VERS >= DARWIN_10_10
   /* _platform_strchr$VARIANT$Generic */
-  STRCHR(libsystemZuplatformZddylib, _platform_strchr$VARIANT$Generic)
+  STRCHR(VG_Z_LIBSYSTEM_PLATFORM_SONAME, _platform_strchr$VARIANT$Generic)
   /* _platform_strchr$VARIANT$Haswell */
-  STRCHR(libsystemZuplatformZddylib, _platform_strchr$VARIANT$Haswell)
+  STRCHR(VG_Z_LIBSYSTEM_PLATFORM_SONAME, _platform_strchr$VARIANT$Haswell)
 # endif
- STRCHR(libsystemZuplatformZddylib, _platform_strchr$VARIANT$Base)
+ STRCHR(VG_Z_LIBSYSTEM_PLATFORM_SONAME, _platform_strchr$VARIANT$Base)
 
 #elif defined(VGO_solaris)
  STRCHR(VG_Z_LIBC_SONAME,          strchr)
@@ -475,7 +475,7 @@ static inline void my_exit ( int x )
 
 #elif defined(VGO_darwin)
 # if DARWIN_VERS == DARWIN_10_9
-  STRNLEN(libsystemZucZddylib, strnlen)
+  STRNLEN(VG_Z_LIBSYSTEM_C_SONAME, strnlen)
 # endif
 
 #elif defined(VGO_solaris)
@@ -524,7 +524,7 @@ static inline void my_exit ( int x )
 #elif defined(VGO_darwin)
  STRLEN(VG_Z_LIBC_SONAME, strlen)
 # if DARWIN_VERS >= DARWIN_10_9
-  STRLEN(libsystemZucZddylib, strlen)
+  STRLEN(VG_Z_LIBSYSTEM_C_SONAME, strlen)
 # endif
 
 #elif defined(VGO_solaris)
@@ -573,7 +573,7 @@ static inline void my_exit ( int x )
 #elif defined(VGO_darwin)
  STRCPY(VG_Z_LIBC_SONAME, strcpy)
 # if DARWIN_VERS == DARWIN_10_9
-  STRCPY(libsystemZucZddylib, strcpy)
+  STRCPY(VG_Z_LIBSYSTEM_C_SONAME, strcpy)
 # endif
 
 #elif defined(VGO_solaris)
@@ -621,7 +621,7 @@ static inline void my_exit ( int x )
 #elif defined(VGO_darwin)
  STRNCPY(VG_Z_LIBC_SONAME, strncpy)
 # if DARWIN_VERS >= DARWIN_10_9
-  STRNCPY(libsystemZucZddylib, strncpy)
+  STRNCPY(VG_Z_LIBSYSTEM_C_SONAME, strncpy)
 # endif
 
 #elif defined(VGO_solaris)
@@ -730,7 +730,7 @@ static inline void my_exit ( int x )
 #elif defined(VGO_darwin)
  STRNCMP(VG_Z_LIBC_SONAME,        strncmp)
 # if DARWIN_VERS >= DARWIN_10_9
-  STRNCMP(libsystemZuplatformZddylib, _platform_strncmp)
+  STRNCMP(VG_Z_LIBSYSTEM_PLATFORM_SONAME, _platform_strncmp)
 # endif
 
 #elif defined(VGO_solaris)
@@ -957,7 +957,7 @@ static inline void my_exit ( int x )
 #elif defined(VGO_darwin)
  STRCMP(VG_Z_LIBC_SONAME, strcmp)
 # if DARWIN_VERS >= DARWIN_10_9
-  STRCMP(libsystemZuplatformZddylib, _platform_strcmp)
+  STRCMP(VG_Z_LIBSYSTEM_PLATFORM_SONAME, _platform_strcmp)
 # endif
 
 #elif defined(VGO_solaris)
@@ -993,18 +993,18 @@ static inline void my_exit ( int x )
 #elif defined(VGO_darwin)
 # if DARWIN_VERS == DARWIN_10_9
   MEMCHR(VG_Z_DYLD,                   memchr)
-  MEMCHR(libsystemZuplatformZddylib, _platform_memchr)
+  MEMCHR(VG_Z_LIBSYSTEM_PLATFORM_SONAME, _platform_memchr)
 # endif
 # if DARWIN_VERS >= DARWIN_10_10
   MEMCHR(VG_Z_DYLD,                   memchr)
   /* _platform_memchr$VARIANT$Generic */
-  MEMCHR(libsystemZuplatformZddylib, _platform_memchr$VARIANT$Generic)
+  MEMCHR(VG_Z_LIBSYSTEM_PLATFORM_SONAME, _platform_memchr$VARIANT$Generic)
   /* _platform_memchr$VARIANT$Haswell */
-  MEMCHR(libsystemZuplatformZddylib, _platform_memchr$VARIANT$Haswell)
+  MEMCHR(VG_Z_LIBSYSTEM_PLATFORM_SONAME, _platform_memchr$VARIANT$Haswell)
 # endif
 # if DARWIN_VERS >= DARWIN_10_12
   /* _platform_memchr$VARIANT$Base */
-  MEMCHR(libsystemZuplatformZddylib, _platform_memchr$VARIANT$Base)
+  MEMCHR(VG_Z_LIBSYSTEM_PLATFORM_SONAME, _platform_memchr$VARIANT$Base)
 #endif
 
 #elif defined(VGO_solaris)
@@ -1242,7 +1242,7 @@ static inline void my_exit ( int x )
 
 #elif defined(VGO_darwin)
 # if DARWIN_VERS >= DARWIN_10_9
-  MEMCMP(libsystemZuplatformZddylib, _platform_memcmp)
+  MEMCMP(VG_Z_LIBSYSTEM_PLATFORM_SONAME, _platform_memcmp)
 # endif
 
 #elif defined(VGO_solaris)
@@ -1432,7 +1432,7 @@ static inline void my_exit ( int x )
  MEMMOVE(VG_Z_LIBC_SONAME,  memmoveZDVARIANTZDsse42) /* memmove$VARIANT$sse42 */
 # if DARWIN_VERS >= DARWIN_10_9
   /* _platform_memmove$VARIANT$Ivybridge, Nehelem etc. */
-  MEMMOVE(libsystemZuplatformZddylib, ZuplatformZumemmoveZDVARIANTZDZa)
+  MEMMOVE(VG_Z_LIBSYSTEM_PLATFORM_SONAME, ZuplatformZumemmoveZDVARIANTZDZa)
 # endif
 
 #elif defined(VGO_solaris)
@@ -2383,7 +2383,7 @@ static inline void my_exit ( int x )
 #if defined(VGO_linux) || defined(VGO_freebsd) || defined(VGO_solaris)
  MEMCCPY(VG_Z_LIBC_SONAME, memccpy)
 #elif defined(VGO_darwin)
- MEMCCPY(libsystemZuplatformZddylib, _platform_memccpy)
+ MEMCCPY(VG_Z_LIBSYSTEM_PLATFORM_SONAME, _platform_memccpy)
 #endif
 
  /*---------------------- wcpncpy ----------------------*/
@@ -2428,7 +2428,7 @@ static inline void my_exit ( int x )
 #if defined(VGO_linux) || defined(VGO_freebsd) || defined(VGO_solaris)
  WCPNCPY(VG_Z_LIBC_SONAME, wcpncpy)
 #elif defined(VGO_darwin)
- WCPNCPY(libsystemZucZddylib, wcpncpy)
+ WCPNCPY(VG_Z_LIBSYSTEM_C_SONAME, wcpncpy)
 #endif
 
 /*----------------------- wcscat ----------------------*/