From: Paul Floyd Date: Fri, 27 Jan 2023 07:42:06 +0000 (+0100) Subject: Bug 382034 - Testcases build fixes for musl X-Git-Tag: VALGRIND_3_21_0~199 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f7e4bb4af294575432b629de4869812fdfee6feb;p=thirdparty%2Fvalgrind.git Bug 382034 - Testcases build fixes for musl --- diff --git a/NEWS b/NEWS index 9c2410d89a..7990a8a56f 100644 --- a/NEWS +++ b/NEWS @@ -78,6 +78,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 170510 Don't warn about ioctl of size 0 without direction hint 241072 List tools in --help output 327548 false positive while destroying mutex +382034 Testcases build fixes for musl 351857 confusing error message about valid command line option 392331 Spurious lock not held error from inside pthread_cond_timedwait 400793 pthread_rwlock_timedwrlock false positive diff --git a/memcheck/tests/arm64-linux/scalar.h b/memcheck/tests/arm64-linux/scalar.h index 9008816d6e..8ef050f4b0 100644 --- a/memcheck/tests/arm64-linux/scalar.h +++ b/memcheck/tests/arm64-linux/scalar.h @@ -12,6 +12,10 @@ #include #include +#ifndef __THROW +#define __THROW +#endif + // Since we use vki_unistd.h, we can't include . So we have to // declare this ourselves. extern long int syscall (long int __sysno, ...) __THROW; diff --git a/memcheck/tests/x86-linux/scalar.h b/memcheck/tests/x86-linux/scalar.h index ef28b03550..52f742e4ac 100644 --- a/memcheck/tests/x86-linux/scalar.h +++ b/memcheck/tests/x86-linux/scalar.h @@ -11,6 +11,10 @@ #include #include +#ifndef __THROW +#define __THROW +#endif + // Since we use vki_unistd.h, we can't include . So we have to // declare this ourselves. extern long int syscall (long int __sysno, ...) __THROW; diff --git a/none/tests/x86-linux/seg_override.c b/none/tests/x86-linux/seg_override.c index b7619c9a80..ca8fbfe2b2 100644 --- a/none/tests/x86-linux/seg_override.c +++ b/none/tests/x86-linux/seg_override.c @@ -2,6 +2,8 @@ #include #include #include +#include "../../../config.h" + /* Stuff from Wine. */ @@ -52,14 +54,19 @@ inline static unsigned int wine_ldt_get_limit( const LDT_ENTRY *ent ) /* our copy of the ldt */ LDT_ENTRY ldt_copy[8192]; +#if defined(MUSL_LIBC) +#define MODIFY_LDT(func, ptr, bytecount) syscall(SYS_modify_ldt, (func), (ptr), (bytecount) ); +#else +#define MODIFY_LDT(func, ptr, bytecount) __modify_ldt((func), (ptr), (bytecount) ); /* System call to set LDT entry. */ //extern int __modify_ldt (int, struct modify_ldt_ldt_s *, size_t); extern int __modify_ldt (int, void *, size_t); +#endif void print_ldt ( void ) { int res; - res = __modify_ldt( 0, ldt_copy, 8192*sizeof(LDT_ENTRY) ); + res = MODIFY_LDT( 0, ldt_copy, 8192*sizeof(LDT_ENTRY) ); printf("got %d bytes\n", res ); perror("error is"); } @@ -102,7 +109,7 @@ void set_ldt1 ( void* base ) ldt_entry.read_exec_only = 0; ldt_entry.limit_in_pages = 0; ldt_entry.seg_not_present = 0; - stat = __modify_ldt (1, &ldt_entry, sizeof (ldt_entry)); + stat = MODIFY_LDT (1, &ldt_entry, sizeof (ldt_entry)); printf("stat = %d\n", stat); }