Index: gcc-7-7.3.0-8.1/src/libgo/configure.ac =================================================================== --- gcc-7-7.3.0-8.1.orig/src/libgo/configure.ac +++ gcc-7-7.3.0-8.1/src/libgo/configure.ac @@ -146,7 +146,7 @@ AC_SUBST(go_include) # All known GOOS values. This is the union of all operating systems # supported by the gofrontend and all operating systems supported by # the gc toolchain. -ALLGOOS="android darwin dragonfly freebsd irix linux netbsd openbsd plan9 rtems solaris windows" +ALLGOOS="android darwin dragonfly freebsd irix gnu linux netbsd openbsd plan9 rtems solaris windows" is_darwin=no is_freebsd=no @@ -157,6 +157,7 @@ is_openbsd=no is_dragonfly=no is_rtems=no is_solaris=no +is_gnu=no GOOS=unknown case ${host} in *-*-darwin*) is_darwin=yes; GOOS=darwin ;; @@ -168,6 +169,7 @@ case ${host} in *-*-dragonfly*) is_dragonfly=yes; GOOS=dragonfly ;; *-*-rtems*) is_rtems=yes; GOOS=rtems ;; *-*-solaris2*) is_solaris=yes; GOOS=solaris ;; + *-*-gnu*) is_gnu=yes; GOOS=gnu ;; esac AM_CONDITIONAL(LIBGO_IS_DARWIN, test $is_darwin = yes) AM_CONDITIONAL(LIBGO_IS_FREEBSD, test $is_freebsd = yes) @@ -178,6 +180,7 @@ AM_CONDITIONAL(LIBGO_IS_OPENBSD, test $i 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_GNU, test $is_gnu = 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) @@ -838,6 +841,14 @@ main () CFLAGS="$CFLAGS_hold" LIBS="$LIBS_hold" ]) + +case ${host} in + *-*-gnu*) + LIBS="$LIBS -lpthread" + AC_SUBST(LIBS) + ;; +esac + dnl overwrite for the mips* 64bit multilibs, fails on some buildds if test "$libgo_cv_lib_setcontext_clobbers_tls" = "yes"; then case "$target" in Index: gcc-7-7.3.0-8.1/src/libgo/Makefile.am =================================================================== --- gcc-7-7.3.0-8.1.orig/src/libgo/Makefile.am +++ gcc-7-7.3.0-8.1/src/libgo/Makefile.am @@ -420,10 +420,14 @@ else if LIBGO_IS_NETBSD runtime_getncpu_file = runtime/getncpu-bsd.c else +if LIBGO_IS_GNU +runtime_getncpu_file = runtime/getncpu-gnu.c +else runtime_getncpu_file = runtime/getncpu-none.c endif endif endif +endif endif endif endif Index: gcc-7-7.3.0-8.1/src/libgo/Makefile.in =================================================================== --- gcc-7-7.3.0-8.1.orig/src/libgo/Makefile.in +++ gcc-7-7.3.0-8.1/src/libgo/Makefile.in @@ -183,7 +183,8 @@ libgo_llgo_la_DEPENDENCIES = $(am__DEPEN @LIBGO_IS_LINUX_FALSE@am__objects_2 = thread-sema.lo @LIBGO_IS_LINUX_TRUE@am__objects_2 = thread-linux.lo @LIBGO_IS_RTEMS_TRUE@am__objects_3 = rtems-task-variable-add.lo -@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_4 = getncpu-none.lo +@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_GNU_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@am__objects_4 = getncpu-none.lo +@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_GNU_TRUE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@am__objects_4 = getncpu-gnu.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_4 = 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_4 = getncpu-bsd.lo @LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@am__objects_4 = getncpu-solaris.lo @@ -768,7 +769,8 @@ toolexeclibgounicode_DATA = \ @LIBGO_IS_RTEMS_TRUE@rtems_task_variable_add_file = runtime/rtems-task-variable-add.c @LIBGO_IS_LINUX_FALSE@runtime_thread_files = runtime/thread-sema.c @LIBGO_IS_LINUX_TRUE@runtime_thread_files = runtime/thread-linux.c -@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_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_GNU_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_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_GNU_TRUE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@runtime_getncpu_file = runtime/getncpu-gnu.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 @LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@runtime_getncpu_file = runtime/getncpu-solaris.c @@ -1086,7 +1088,7 @@ BUILDGOX = \ $(SHELL) $(srcdir)/mvifdiff.sh $@.tmp `echo $@ | sed -e 's/s-gox/gox/'` GOTESTFLAGS = -GOBENCH = +GOBENCH = # Check a package. CHECK = \ @@ -1494,6 +1496,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aeshash.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/env_posix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getncpu-bsd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getncpu-gnu.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getncpu-irix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getncpu-linux.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getncpu-none.Plo@am__quote@ @@ -1979,6 +1982,13 @@ getncpu-none.lo: runtime/getncpu-none.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o getncpu-none.lo `test -f 'runtime/getncpu-none.c' || echo '$(srcdir)/'`runtime/getncpu-none.c +getncpu-gnu.lo: runtime/getncpu-gnu.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT getncpu-gnu.lo -MD -MP -MF $(DEPDIR)/getncpu-gnu.Tpo -c -o getncpu-gnu.lo `test -f 'runtime/getncpu-gnu.c' || echo '$(srcdir)/'`runtime/getncpu-gnu.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/getncpu-gnu.Tpo $(DEPDIR)/getncpu-gnu.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/getncpu-gnu.c' object='getncpu-gnu.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o getncpu-gnu.lo `test -f 'runtime/getncpu-gnu.c' || echo '$(srcdir)/'`runtime/getncpu-gnu.c + getncpu-bsd.lo: runtime/getncpu-bsd.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT getncpu-bsd.lo -MD -MP -MF $(DEPDIR)/getncpu-bsd.Tpo -c -o getncpu-bsd.lo `test -f 'runtime/getncpu-bsd.c' || echo '$(srcdir)/'`runtime/getncpu-bsd.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/getncpu-bsd.Tpo $(DEPDIR)/getncpu-bsd.Plo Index: gcc-7-7.3.0-8.1/src/libgo/match.sh =================================================================== --- gcc-7-7.3.0-8.1.orig/src/libgo/match.sh +++ gcc-7-7.3.0-8.1/src/libgo/match.sh @@ -113,7 +113,7 @@ for f in $gofiles; do "") ;; $goarch) ;; $goos) ;; - android | darwin | dragonfly | freebsd | linux | nacl | netbsd | openbsd | plan9 | solaris | windows) + android | darwin | dragonfly | freebsd | gnu | linux | nacl | netbsd | openbsd | plan9 | solaris | windows) tag1=nonmatchingtag ;; 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | ppc | s390 | s390x | sparc | sparc64) @@ -125,7 +125,7 @@ for f in $gofiles; do "") ;; $goarch) ;; $goos) ;; - android | darwin | dragonfly | freebsd | linux | nacl | netbsd | openbsd | plan9 | solaris | windows) + android | darwin | dragonfly | freebsd | gnu | linux | nacl | netbsd | openbsd | plan9 | solaris | windows) tag2=nonmatchingtag ;; 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | ppc | s390 | s390x | sparc | sparc64) Index: gcc-7-7.3.0-8.1/src/libgo/mksigtab.sh =================================================================== --- gcc-7-7.3.0-8.1.orig/src/libgo/mksigtab.sh +++ gcc-7-7.3.0-8.1/src/libgo/mksigtab.sh @@ -29,7 +29,13 @@ echo ' _SIGINT: {_SigNotify + _SigKil echo ' _SIGQUIT: {_SigNotify + _SigThrow, "SIGQUIT: quit"},' echo ' _SIGILL: {_SigThrow + _SigUnblock, "SIGILL: illegal instruction"},' echo ' _SIGTRAP: {_SigThrow + _SigUnblock, "SIGTRAP: trace trap"},' +# Special treatment of SIGABRT for GNU/Hurd +# /usr/include/i386-gnu/bits/signum.h: #define SIGABRT SIGIOT +if egrep 'define SIGABRT SIGIOT' gen-sysinfo.go > /dev/null 2>&1; then +echo ' _SIGIOT: {_SigNotify + _SigThrow, "SIGIOT: abort"},' +else echo ' _SIGABRT: {_SigNotify + _SigThrow, "SIGABRT: abort"},' +fi echo ' _SIGBUS: {_SigPanic + _SigUnblock, "SIGBUS: bus error"},' echo ' _SIGFPE: {_SigPanic + _SigUnblock, "SIGFPE: floating-point exception"},' echo ' _SIGKILL: {0, "SIGKILL: kill"},' @@ -77,6 +83,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. @@ -91,6 +98,11 @@ if test -z "$nsig"; then 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: gcc-7-7.3.0-8.1/src/libgo/mksysinfo.sh =================================================================== --- gcc-7-7.3.0-8.1.orig/src/libgo/mksysinfo.sh +++ gcc-7-7.3.0-8.1/src/libgo/mksysinfo.sh @@ -43,8 +43,19 @@ grep -v '^// ' gen-sysinfo.go | \ >> ${OUT} # The errno constants. These get type Errno. - egrep '#define E[A-Z0-9_]+ ' errno.i | \ - sed -e 's/^#define \(E[A-Z0-9_]*\) .*$/const \1 = Errno(_\1)/' >> ${OUT} +egrep '#define E[A-Z0-9_]+ [0-9]' 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} + +# Special treatment of EWOULDBLOCK for GNU/Hurd +# /usr/include/i386-gnu/bits/errno.h: #define EWOULDBLOCK EAGAIN +if egrep '^const _EWOULDBLOCK = _EAGAIN' gen-sysinfo.go > /dev/null 2>&1; then + if egrep '^const EAGAIN = Errno\(_EAGAIN\)' ${OUT}; then + echo 'const EWOULDBLOCK = Errno(_EAGAIN)' >> ${OUT} + fi +fi # The O_xxx flags. egrep '^const _(O|F|FD)_' gen-sysinfo.go | \ @@ -61,6 +72,11 @@ if ! grep '^const F_DUPFD_CLOEXEC' ${OUT echo "const F_DUPFD_CLOEXEC = 0" >> ${OUT} fi +# 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 + # These flags can be lost on i386 GNU/Linux when using # -D_FILE_OFFSET_BITS=64, because we see "#define F_SETLK F_SETLK64" # before we see the definition of F_SETLK64. @@ -425,6 +441,11 @@ grep '^type _tms ' gen-sysinfo.go | \ # The stat type. # Prefer largefile variant if available. +# Special treatment of st_dev for GNU/Hurd +# /usr/include/i386-gnu/bits/stat.h: #define st_dev st_fsid +if grep 'define st_dev st_fsid' gen-sysinfo.go > /dev/null 2>&1; then + sed -i -e 's/; st_fsid/; st_dev/' gen-sysinfo.go +fi stat=`grep '^type _stat64 ' gen-sysinfo.go || true` if test "$stat" != ""; then grep '^type _stat64 ' gen-sysinfo.go