libgo: add configury and sysinfo support for hurd

Patch by Svante Signell.
    
    Reviewed-on: https://go-review.googlesource.com/c/160824

From-SVN: r268461
This commit is contained in:
Ian Lance Taylor 2019-02-01 22:46:39 +00:00
parent 59ea40d0f2
commit d9f0237f70
7 changed files with 57 additions and 6 deletions

View File

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

View File

@ -428,6 +428,9 @@ 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
@ -436,6 +439,7 @@ endif
endif
endif
endif
endif
runtime_files = \
runtime/aeshash.c \

View File

@ -230,7 +230,8 @@ am__DEPENDENCIES_4 = $(am__DEPENDENCIES_2) \
libgo_llgo_la_DEPENDENCIES = $(am__DEPENDENCIES_4)
@LIBGO_IS_RTEMS_TRUE@am__objects_1 = \
@LIBGO_IS_RTEMS_TRUE@ runtime/rtems-task-variable-add.lo
@LIBGO_IS_AIX_FALSE@@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@am__objects_2 = runtime/getncpu-none.lo
@LIBGO_IS_AIX_FALSE@@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_HURD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@am__objects_2 = runtime/getncpu-none.lo
@LIBGO_IS_AIX_FALSE@@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_HURD_TRUE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@am__objects_2 = runtime/getncpu-hurd.lo
@LIBGO_IS_AIX_TRUE@@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@am__objects_2 = runtime/getncpu-aix.lo
@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_TRUE@@LIBGO_IS_SOLARIS_FALSE@am__objects_2 = runtime/getncpu-bsd.lo
@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@am__objects_2 = runtime/getncpu-bsd.lo
@ -855,7 +856,8 @@ noinst_DATA = internal/x/net/internal/nettest.gox \
zdefaultcc.go
@LIBGO_IS_RTEMS_FALSE@rtems_task_variable_add_file =
@LIBGO_IS_RTEMS_TRUE@rtems_task_variable_add_file = runtime/rtems-task-variable-add.c
@LIBGO_IS_AIX_FALSE@@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@runtime_getncpu_file = runtime/getncpu-none.c
@LIBGO_IS_AIX_FALSE@@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_HURD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@runtime_getncpu_file = runtime/getncpu-none.c
@LIBGO_IS_AIX_FALSE@@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_HURD_TRUE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@runtime_getncpu_file = runtime/getncpu-hurd.c
@LIBGO_IS_AIX_TRUE@@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@runtime_getncpu_file = runtime/getncpu-aix.c
@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_TRUE@@LIBGO_IS_SOLARIS_FALSE@runtime_getncpu_file = runtime/getncpu-bsd.c
@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@runtime_getncpu_file = runtime/getncpu-bsd.c
@ -1378,6 +1380,8 @@ runtime/rtems-task-variable-add.lo: runtime/$(am__dirstamp) \
runtime/$(DEPDIR)/$(am__dirstamp)
runtime/getncpu-none.lo: runtime/$(am__dirstamp) \
runtime/$(DEPDIR)/$(am__dirstamp)
runtime/getncpu-hurd.lo: runtime/$(am__dirstamp) \
runtime/$(DEPDIR)/$(am__dirstamp)
runtime/getncpu-aix.lo: runtime/$(am__dirstamp) \
runtime/$(DEPDIR)/$(am__dirstamp)
runtime/getncpu-bsd.lo: runtime/$(am__dirstamp) \
@ -1407,6 +1411,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/env_posix.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/getncpu-aix.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/getncpu-bsd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/getncpu-hurd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/getncpu-irix.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/getncpu-linux.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@runtime/$(DEPDIR)/getncpu-none.Plo@am__quote@

20
libgo/configure vendored
View File

@ -669,6 +669,8 @@ ALLGOOS
GOOS
LIBGO_IS_BSD_FALSE
LIBGO_IS_BSD_TRUE
LIBGO_IS_HURD_FALSE
LIBGO_IS_HURD_TRUE
LIBGO_IS_AIX_FALSE
LIBGO_IS_AIX_TRUE
LIBGO_IS_SOLARIS_FALSE
@ -11341,7 +11343,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11344 "configure"
#line 11346 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -11447,7 +11449,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11450 "configure"
#line 11452 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -13756,6 +13758,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 ;;
@ -13768,6 +13771,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
if test $is_darwin = yes; then
LIBGO_IS_DARWIN_TRUE=
@ -13849,6 +13853,14 @@ else
LIBGO_IS_AIX_FALSE=
fi
if test $is_hurd = yes; then
LIBGO_IS_HURD_TRUE=
LIBGO_IS_HURD_FALSE='#'
else
LIBGO_IS_HURD_TRUE='#'
LIBGO_IS_HURD_FALSE=
fi
if test $is_darwin = yes -o $is_dragonfly = yes -o $is_freebsd = yes -o $is_netbsd = yes -o $is_openbsd = yes; then
LIBGO_IS_BSD_TRUE=
LIBGO_IS_BSD_FALSE='#'
@ -15852,6 +15864,10 @@ if test -z "${LIBGO_IS_AIX_TRUE}" && test -z "${LIBGO_IS_AIX_FALSE}"; then
as_fn_error $? "conditional \"LIBGO_IS_AIX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGO_IS_HURD_TRUE}" && test -z "${LIBGO_IS_HURD_FALSE}"; then
as_fn_error $? "conditional \"LIBGO_IS_HURD\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGO_IS_BSD_TRUE}" && test -z "${LIBGO_IS_BSD_FALSE}"; then
as_fn_error $? "conditional \"LIBGO_IS_BSD\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5

View File

@ -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 $is_dragonfly = yes)
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)

View File

@ -91,6 +91,7 @@ checksig _SIGCANCEL '{_SigSetStack + _SigUnblock, "SIGCANCEL: reserved signal f
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

View File

@ -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.go | \
-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/' \