]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Bug 382034 - Testcases build fixes for musl
authorPaul Floyd <pjfloyd@wanadoo.fr>
Fri, 27 Jan 2023 07:42:06 +0000 (08:42 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Fri, 27 Jan 2023 07:42:06 +0000 (08:42 +0100)
NEWS
memcheck/tests/arm64-linux/scalar.h
memcheck/tests/x86-linux/scalar.h
none/tests/x86-linux/seg_override.c

diff --git a/NEWS b/NEWS
index 9c2410d89a4c676cf883a2b35822aba94fbd25df..7990a8a56ffa496bfeb62bb7b8228d686f9c961b 100644 (file)
--- 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
index 9008816d6e87eda83332028e016ff630831b2a7b..8ef050f4b071344cf2cbbf43cb905577b57e879d 100644 (file)
 #include <sys/types.h>
 #include <sys/mman.h>
 
+#ifndef __THROW
+#define __THROW
+#endif
+
 // Since we use vki_unistd.h, we can't include <unistd.h>.  So we have to
 // declare this ourselves.
 extern long int syscall (long int __sysno, ...) __THROW;
index ef28b035508cf5c3d358b239e3f78b5dee582ea5..52f742e4ac760d6ee3b0f1854de9aa899cd9a636 100644 (file)
 #include <sys/types.h>
 #include <sys/mman.h>
 
+#ifndef __THROW
+#define __THROW
+#endif
+
 // Since we use vki_unistd.h, we can't include <unistd.h>.  So we have to
 // declare this ourselves.
 extern long int syscall (long int __sysno, ...) __THROW;
index b7619c9a802972438c8389b2b52ce41604df2c74..ca8fbfe2b2610dfa79a8307883fbdb9cd7f1a022 100644 (file)
@@ -2,6 +2,8 @@
 #include <stdio.h>
 #include <errno.h>
 #include <string.h>
+#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);
 }