diff mbox series

libgo patch committed: Hurd configury

Message ID CAOyqgcVxQHB6ieU4fSyFcONPWtx-BFb1KVo5-Wt-m67zk=K-8g@mail.gmail.com
State New
Headers show
Series libgo patch committed: Hurd configury | expand

Commit Message

Ian Lance Taylor Feb. 1, 2019, 10:46 p.m. UTC
This libgo patch by Svante Signell adds Hurd configury support, and
also sysinfo/sigtab support.  On Hurd systems it expects a file that
will be added in a later patch.  Bootstrapped and ran Go testsuite on
x86_64-pc-linux-gnu.  Committed to mainline.

Ian

Comments

Ian Lance Taylor Feb. 1, 2019, 10:56 p.m. UTC | #1
And this patch adds the new expected file,
libgo/runtime/getncpu-hurd.c.  Bootstrapped and ran Go testsuite on
x86_64-pc-linux-gnu.  Committed to mainline.

Ian
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 268461)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@
-51fb93fd71b8a0a690455dfdd3d12b2aa0171f5c
+582392b80c07bd7e830e177b775dc4ef802b5fd6
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/runtime/getncpu-hurd.c
===================================================================
--- libgo/runtime/getncpu-hurd.c	(nonexistent)
+++ libgo/runtime/getncpu-hurd.c	(working copy)
@@ -0,0 +1,16 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+#include <unistd.h>
+
+#include "runtime.h"
+#include "defs.h"
+
+int32
+getproccount(void)
+{
+	int32 n;
+	n = (int32)sysconf(_SC_NPROCESSORS_ONLN);
+	return n > 1 ? n : 1;
+}
diff mbox series

Patch

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 268460)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@ 
-87dd981901c645a7d54a52c5f4c35caec31a8978
+51fb93fd71b8a0a690455dfdd3d12b2aa0171f5c
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/Makefile.am
===================================================================
--- libgo/Makefile.am	(revision 268458)
+++ libgo/Makefile.am	(working copy)
@@ -428,10 +428,14 @@  else
 if LIBGO_IS_AIX
 runtime_getncpu_file = runtime/getncpu-aix.c
 else
+if LIBGO_IS_HURD
+runtime_getncpu_file = runtime/getncpu-hurd.c
+else
 runtime_getncpu_file = runtime/getncpu-none.c
 endif
 endif
 endif
+endif
 endif
 endif
 endif
Index: libgo/configure.ac
===================================================================
--- libgo/configure.ac	(revision 268458)
+++ libgo/configure.ac	(working copy)
@@ -165,6 +165,7 @@  is_dragonfly=no
 is_rtems=no
 is_solaris=no
 is_aix=no
+is_hurd=no
 GOOS=unknown
 case ${host} in
   *-*-darwin*)   is_darwin=yes;  GOOS=darwin ;;
@@ -177,6 +178,7 @@  case ${host} in
   *-*-rtems*)    is_rtems=yes;   GOOS=rtems ;;
   *-*-solaris2*) is_solaris=yes; GOOS=solaris ;;
   *-*-aix*)      is_aix=yes;     GOOS=aix ;;
+  *-*-gnu*)      is_hurd=yes;    GOOS=hurd ;;
 esac
 AM_CONDITIONAL(LIBGO_IS_DARWIN, test $is_darwin = yes)
 AM_CONDITIONAL(LIBGO_IS_FREEBSD, test $is_freebsd = yes)
@@ -188,6 +190,7 @@  AM_CONDITIONAL(LIBGO_IS_DRAGONFLY, test
 AM_CONDITIONAL(LIBGO_IS_RTEMS, test $is_rtems = yes)
 AM_CONDITIONAL(LIBGO_IS_SOLARIS, test $is_solaris = yes)
 AM_CONDITIONAL(LIBGO_IS_AIX, test $is_aix = yes)
+AM_CONDITIONAL(LIBGO_IS_HURD, test $is_hurd = yes)
 AM_CONDITIONAL(LIBGO_IS_BSD, test $is_darwin = yes -o $is_dragonfly = yes -o $is_freebsd = yes -o $is_netbsd = yes -o $is_openbsd = yes)
 AC_SUBST(GOOS)
 AC_SUBST(ALLGOOS)
Index: libgo/mksigtab.sh
===================================================================
--- libgo/mksigtab.sh	(revision 268369)
+++ libgo/mksigtab.sh	(working copy)
@@ -91,6 +91,7 @@  checksig _SIGCANCEL  '{_SigSetStack + _S
 checksig _SIGXRES    '{_SigNotify, "SIGXRES: resource control exceeded"}'
 checksig _SIGJVM1    '{_SigNotify, "SIGJVM1: reserved signal for Java Virtual Machine"}'
 checksig _SIGJVM2    '{_SigNotify, "SIGJVM2: reserved signal for Java Virtual Machine"}'
+checksig _SIGLOST '   {_SigNotify, "SIGLOST: resource lost (Sun); server died (GNU)"}'
 
 # Special handling of signals 32 and 33 on GNU/Linux systems,
 # because they are special to glibc.
@@ -112,6 +113,11 @@  else
 	    rtmax=`grep 'const _*SIGRTMAX = [0-9]*$' gen-sysinfo.go | sed -e 's/.* = \([0-9]*\)/\1/'`
 	    if test -n "$rtmax"; then
 		nsig=`expr $rtmax + 1`
+	    elif grep 'const _*SIGRTMAX = [ (]*_*SIGRTMIN[ )]*' gen-sysinfo.go >/dev/null 2>&1; then
+		rtmin=`grep 'const _*SIGRTMIN = [0-9]*$' gen-sysinfo.go | sed -e 's/.* = \([0-9]*\)/\1/'`
+		if test -n "$rtmin"; then
+		    nsig=`expr $rtmin + 1`
+		fi
 	    fi
 	fi
     fi
Index: libgo/mksysinfo.sh
===================================================================
--- libgo/mksysinfo.sh	(revision 268369)
+++ libgo/mksysinfo.sh	(working copy)
@@ -55,9 +55,13 @@  grep '^type _mld_hdr_t ' gen-sysinfo.go
   sed -e 's/_in6_addr/[16]byte/' >> ${OUT}
 
 # The errno constants.  These get type Errno.
-  egrep '#define E[A-Z0-9_]+ ' errno.i | \
+egrep '#define E[A-Z0-9_]+ [0-9E]' errno.i | \
   sed -e 's/^#define \(E[A-Z0-9_]*\) .*$/const \1 = Errno(_\1)/' >> ${OUT}
 
+# Workaround for GNU/Hurd _EMIG_* errors having negative values
+egrep '#define E[A-Z0-9_]+ -[0-9]' errno.i | \
+  sed -e 's/^#define \(E[A-Z0-9_]*\) .*$/const \1 = Errno(-_\1)/' >> ${OUT}
+
 # The O_xxx flags.
 egrep '^const _(O|F|FD)_' gen-sysinfo.go | \
   sed -e 's/^\(const \)_\([^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
@@ -130,6 +134,11 @@  grep '^const _SYS_' gen-sysinfo.go | \
     echo "const $sup = _$sys" >> ${OUT}
   done
 
+# Special treatment of SYS_IOCTL for GNU/Hurd.
+if ! grep '^const SYS_IOCTL' ${OUT} > /dev/null 2>&1; then
+  echo "const SYS_IOCTL = 0" >> ${OUT}
+fi
+
 # The GNU/Linux support wants to use SYS_GETDENTS64 if available.
 if ! grep '^const SYS_GETDENTS ' ${OUT} >/dev/null 2>&1; then
   echo "const SYS_GETDENTS = 0" >> ${OUT}
@@ -475,6 +484,13 @@  grep '^type _st_timespec ' gen-sysinfo.g
       -e 's/tv_sec/Sec/' \
       -e 's/tv_nsec/Nsec/' >> ${OUT}
 
+# Special treatment of struct stat st_dev for GNU/Hurd
+# /usr/include/i386-gnu/bits/stat.h: #define st_dev st_fsid
+fsid_to_dev=
+if grep 'define st_dev st_fsid' gen-sysinfo.go > /dev/null 2>&1; then
+  fsid_to_dev="-e 's/st_fsid/Dev/'"
+fi
+
 # The stat type.
 # Prefer largefile variant if available.
 stat=`grep '^type _stat64 ' gen-sysinfo.go || true`
@@ -485,6 +501,7 @@  else
 fi | sed -e 's/type _stat64/type Stat_t/' \
          -e 's/type _stat/type Stat_t/' \
          -e 's/st_dev/Dev/' \
+         ${fsid_to_dev} \
          -e 's/st_ino/Ino/g' \
          -e 's/st_nlink/Nlink/' \
          -e 's/st_mode/Mode/' \