From: Paul Floyd Date: Mon, 22 Nov 2021 07:42:53 +0000 (+0100) Subject: Bug 445300 [PATCH] Fix building tests with Musl X-Git-Tag: VALGRIND_3_19_0~72 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e484eee0bdf0a77fc260b69ac7495352e1a972e3;p=thirdparty%2Fvalgrind.git Bug 445300 [PATCH] Fix building tests with Musl Patch contributed by Alyssa Ross --- diff --git a/NEWS b/NEWS index 708c6e1df7..567f19daa8 100644 --- 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 diff --git a/configure.ac b/configure.ac index cb836dbff5..4623d12b5b 100755 --- a/configure.ac +++ b/configure.ac @@ -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 declares struct statx.]) +], [], [ + #define _GNU_SOURCE + #include +]) + #---------------------------------------------------------------------------- # Checks for library functions. @@ -4645,6 +4653,7 @@ AC_CHECK_FUNCS([ \ pthread_yield \ pwritev \ pwritev2 \ + rawmemchr \ readlinkat \ semtimedop \ setcontext \ diff --git a/helgrind/tests/tc20_verifywrap.c b/helgrind/tests/tc20_verifywrap.c index ae97bde8d3..5f8b5b3810 100644 --- a/helgrind/tests/tc20_verifywrap.c +++ b/helgrind/tests/tc20_verifywrap.c @@ -20,14 +20,14 @@ #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; diff --git a/memcheck/tests/linux/sys-statx.c b/memcheck/tests/linux/sys-statx.c index fe9f9ba451..fcbc2e0de7 100644 --- a/memcheck/tests/linux/sys-statx.c +++ b/memcheck/tests/linux/sys-statx.c @@ -1,5 +1,6 @@ /* Test (somewhat) stats and stat. */ #define _GNU_SOURCE +#include "config.h" #include #include #include @@ -7,9 +8,7 @@ #include #include #include -#if __GLIBC_PREREQ(2,28) -/* struct statx provided in sys/stat.h */ -#else +#ifndef HAVE_STRUCT_STATX_IN_SYS_STAT_H #include #endif #include diff --git a/memcheck/tests/str_tester.c b/memcheck/tests/str_tester.c index 7c2ff1e62e..01354eb132 100644 --- a/memcheck/tests/str_tester.c +++ b/memcheck/tests/str_tester.c @@ -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