]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add musl libc configure/compile
authorPetar Jovanovic <mips32r2@gmail.com>
Thu, 6 Apr 2017 12:39:15 +0000 (12:39 +0000)
committerPetar Jovanovic <mips32r2@gmail.com>
Thu, 6 Apr 2017 12:39:15 +0000 (12:39 +0000)
- add musl libc detection (prevents configure error)
- adjust preload and symbol names (based on the OpenWrt patch, see [1])

[1] https://dev.openwrt.org/browser/trunk/package/devel/valgrind/patches/
200-musl_fix.patch?rev=46302

Patch by Peter Seiderer <ps.report@gmx.net>

It fixes Bug 359202.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16296

configure.ac
coregrind/vg_preloaded.c
include/pub_tool_redir.h

index 4c3cc5844674ed6f1ea2e94c686112f1a77baac4..26da681612be3441e9c8a82f032b04e30d3e6c98 100644 (file)
@@ -990,6 +990,13 @@ if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_SOLARIS \
     GLIBC_VERSION="solaris"
 fi
 
+# GLIBC_VERSION is empty if a musl libc is used, so use the toolchain tuple
+# in this case.
+if test x$GLIBC_VERSION = x; then
+    if $CC -dumpmachine | grep -q musl; then
+        GLIBC_VERSION=musl
+    fi
+fi
 
 AC_MSG_CHECKING([the glibc version])
 
@@ -1045,10 +1052,15 @@ case "${GLIBC_VERSION}" in
        # DEFAULT_SUPP set in host_os switch-case above.
        # No other suppression file is used.
        ;;
+     musl)
+       AC_MSG_RESULT(Musl)
+       AC_DEFINE([MUSL_LIBC], 1, [Define to 1 if you're using Musl libc])
+       # no DEFAULT_SUPP file yet for musl libc.
+       ;;
      2.0|2.1|*)
        AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
-       AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later,])
-       AC_MSG_ERROR([Darwin libc, Bionic libc or Solaris libc])
+       AC_MSG_ERROR([Valgrind requires glibc version 2.2 or later, uClibc,])
+       AC_MSG_ERROR([musl libc, Darwin libc, Bionic libc or Solaris libc])
        ;;
 esac
 
index 2f53a7d8fab8dae41fd9a0227a53246fa4a4f8b6..5c5a1bf8dfbaa9d59de85fb162be002d2dfd6722 100644 (file)
@@ -57,7 +57,7 @@
 void VG_NOTIFY_ON_LOAD(freeres)(Vg_FreeresToRun to_run);
 void VG_NOTIFY_ON_LOAD(freeres)(Vg_FreeresToRun to_run)
 {
-#  if !defined(__UCLIBC__) \
+#  if !defined(__UCLIBC__) && !defined(MUSL_LIBC) \
       && !defined(VGPV_arm_linux_android) \
       && !defined(VGPV_x86_linux_android) \
       && !defined(VGPV_mips32_linux_android) \
index a4be688023eb7db8ba5a250ab55f2e4fc9bd8fb8..71c8d448354d74188272e74cec80b8492e6b0e60 100644 (file)
 /* --- Soname of the standard C library. --- */
 
 #if defined(VGO_linux) || defined(VGO_solaris)
+# if defined(MUSL_LIBC)
+#  define  VG_Z_LIBC_SONAME  libcZdZa              // libc.*
+#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
 
 /* --- Soname of the pthreads library. --- */
 
 #if defined(VGO_linux)
+# if defined(MUSL_LIBC)
+#  define  VG_Z_LIBPTHREAD_SONAME  libcZdZa              // libc.*
+#else
 #  define  VG_Z_LIBPTHREAD_SONAME  libpthreadZdsoZd0     // libpthread.so.0
+#endif
 #elif defined(VGO_darwin)
 #  define  VG_Z_LIBPTHREAD_SONAME  libSystemZdZaZddylib  // libSystem.*.dylib
 #elif defined(VGO_solaris)