Bug 445300 [PATCH] Fix building tests with Musl

Patch contributed by
   Alyssa Ross <hi@alyssa.is>
This commit is contained in:
Paul Floyd 2021-11-22 08:42:53 +01:00
parent 02ce9addfa
commit e484eee0bd
5 changed files with 19 additions and 11 deletions

1
NEWS
View File

@ -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

View File

@ -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 \

View File

@ -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;

View 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>

View 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