bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] libgo: Use stub syscall on GNU/Hurd


From: Samuel Thibault
Subject: [PATCH] libgo: Use stub syscall on GNU/Hurd
Date: Tue, 29 Oct 2024 22:03:41 +0100

GNU/Hurd does not actually have syscall(), it just has a stub that
always return ENOSYS, and defines __stub_syscall.  It does however
expose a declaration for it:

  extern long int syscall (long int __sysno, ...) __THROW;

that conflicts with the stub that libgo produces

  int
  syscall(int number __attribute__ ((unused)), ...)

So better match reality by not calling syscall() at all, but not
redefining it either.

Changelog:

        * libgo/go/syscall/syscall_funcs.go: Do not build on GNU/Hurd.
        * libgo/go/syscall/syscall_funcs_stubs.go: Build on GNU/Hurd.
        * libgo/runtime/go-nosys.c: Do not produce syscall() stub on
        GNU/Hurd.

Signed-off-by: Samuel Thibault <samuel.thibault@gnu.org>

diff --git a/libgo/go/syscall/syscall_funcs.go 
b/libgo/go/syscall/syscall_funcs.go
index a906fa5a42e..b62278dc27b 100644
--- a/libgo/go/syscall/syscall_funcs.go
+++ b/libgo/go/syscall/syscall_funcs.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build darwin || dragonfly || freebsd || hurd || linux || netbsd || 
openbsd || solaris
+//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || 
solaris
 // +build darwin dragonfly freebsd hurd linux netbsd openbsd solaris
 
 package syscall
diff --git a/libgo/go/syscall/syscall_funcs_stubs.go 
b/libgo/go/syscall/syscall_funcs_stubs.go
index 11f12bd9ae3..35bc71a5556 100644
--- a/libgo/go/syscall/syscall_funcs_stubs.go
+++ b/libgo/go/syscall/syscall_funcs_stubs.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build aix || rtems
+//go:build aix || hurd || rtems
 // +build aix rtems
 
 // These are stubs.
diff --git a/libgo/runtime/go-nosys.c b/libgo/runtime/go-nosys.c
index 30222df7815..cd3e7664ca0 100644
--- a/libgo/runtime/go-nosys.c
+++ b/libgo/runtime/go-nosys.c
@@ -504,7 +504,7 @@ strerror_r (int errnum, char *buf, size_t buflen)
 
 #endif /* ! HAVE_STRERROR_R */
 
-#ifndef HAVE_SYSCALL
+#if !defined(HAVE_SYSCALL) && !defined(__GNU__) /* GNU/Hurd already has a stub 
*/
 int
 syscall(int number __attribute__ ((unused)), ...)
 {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]