]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Bug 445300 [PATCH] Fix building tests with Musl
authorPaul Floyd <pjfloyd@wanadoo.fr>
Mon, 22 Nov 2021 07:42:53 +0000 (08:42 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Mon, 22 Nov 2021 07:42:53 +0000 (08:42 +0100)
Patch contributed by
   Alyssa Ross <hi@alyssa.is>

NEWS
configure.ac
helgrind/tests/tc20_verifywrap.c
memcheck/tests/linux/sys-statx.c
memcheck/tests/str_tester.c

diff --git a/NEWS b/NEWS
index 708c6e1df73118d70b05aff4f89905fb553ae089..567f19daa85040a8a18fc3ce02d642e7b425efcf 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -50,6 +50,7 @@ are not entered into bugzilla tend to get forgotten about or ignored.
 444836  PPC, pstq instruction for R=1 is not storing to the correct address.
 445032  valgrind/memcheck crash with SIGSEGV when SIGVTALRM timer used and
         libthr.so associated
+445300  [PATCH] Fix building tests with Musl
 445354  arm64 backend: incorrect code emitted for doubleword CAS
 445415  arm64 front end: alignment checks missing for atomic instructions
 
index cb836dbff51170c200118c5d07ed165a697c0703..4623d12b5b1c94771a11aee099adf3ad8485c252 100755 (executable)
@@ -4608,6 +4608,14 @@ AC_TYPE_OFF_T
 AC_TYPE_SIZE_T
 AC_HEADER_TIME
 
+AC_CHECK_TYPE([struct statx], [
+  AC_DEFINE([HAVE_STRUCT_STATX_IN_SYS_STAT_H], 1,
+            [Define to 1 if <sys/stat.h> declares struct statx.])
+], [], [
+  #define _GNU_SOURCE
+  #include <sys/stat.h>
+])
+
 
 #----------------------------------------------------------------------------
 # Checks for library functions.
@@ -4645,6 +4653,7 @@ AC_CHECK_FUNCS([     \
         pthread_yield              \
         pwritev      \
         pwritev2     \
+        rawmemchr    \
         readlinkat   \
         semtimedop   \
         setcontext   \
index ae97bde8d3bfeccfc584edc79a0b6e65f0717951..5f8b5b38105c30aacbcb3cf3a2736f5fab452fe9 100644 (file)
 
 #if !defined(__APPLE__) && !defined(__FreeBSD__)
 
-#if defined(__sun__)
-/* Fake __GLIBC_PREREQ on Solaris. Pretend glibc >= 2.4. */
-# define __GLIBC_PREREQ
-#else
+#if defined(__GLIBC__)
 #if !defined(__GLIBC_PREREQ)
 # error "This program needs __GLIBC_PREREQ (in /usr/include/features.h)"
 #endif
-#endif /* __sun__ */
+#else
+/* Fake __GLIBC_PREREQ. Pretend glibc >= 2.4. */
+# define __GLIBC_PREREQ
+#endif /* __GLIBC__ */
 
 typedef union {
    pthread_spinlock_t spinlock;
index fe9f9ba4518e724071cbd616af8c065d8b322815..fcbc2e0de773c9dcf4647aee355470c2da6fd110 100644 (file)
@@ -1,5 +1,6 @@
 /* Test (somewhat) stats and stat.  */
 #define _GNU_SOURCE
+#include "config.h"
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
@@ -7,9 +8,7 @@
 #include <assert.h>
 #include <string.h>
 #include <sys/syscall.h>
-#if __GLIBC_PREREQ(2,28)
-/* struct statx provided in sys/stat.h */
-#else
+#ifndef HAVE_STRUCT_STATX_IN_SYS_STAT_H
 #include <linux/stat.h>
 #endif
 #include <errno.h>
index 7c2ff1e62ea6d3a0be10c9116eb8f02f30e952a9..01354eb13275f3e0ab44d6ab041502dbd9cd1751 100644 (file)
@@ -503,8 +503,7 @@ test_strchrnul (void)
 }
 #endif
 
-// DDD: better done by testing for the function.
-#if !defined(__APPLE__) && !defined(__sun) && !defined(__FreeBSD__)
+#ifdef HAVE_RAWMEMCHR
 static void
 test_rawmemchr (void)
 {
@@ -1451,7 +1450,7 @@ main (void)
   test_strchrnul ();
 # endif
 
-# if !defined(__APPLE__) && !defined(__sun) && !defined(__FreeBSD__)
+# ifdef HAVE_RAWMEMCHR
   /* rawmemchr.  */
   test_rawmemchr ();
 # endif