Re: [PATCH] New patch for the port of gccgo to GNU/Hurd

2020-09-28 Thread Ian Lance Taylor via Gcc-patches
On Fri, Sep 25, 2020 at 8:04 AM Svante Signell  wrote:
>
> Latest Debian snapshot of gcc (20200917-1) FTBFS due to a missing hurd
> entry in the // +build line of libgo/go/net/fd_posix.go. Attached is a
> patch for that missing entry.

Thanks.  Committed to mainline.

Ian


[PATCH] New patch for the port of gccgo to GNU/Hurd

2020-09-25 Thread Svante Signell via Gcc-patches
Hello,

Latest Debian snapshot of gcc (20200917-1) FTBFS due to a missing hurd
entry in the // +build line of libgo/go/net/fd_posix.go. Attached is a
patch for that missing entry.

With it the latest Debian snapshot has been successfully built. Test
results for libgo and go are:

=== libgo Summary ===

# of expected passes163
# of unexpected failures12

=== go Summary ===

# of expected passes7469
# of unexpected failures10
# of expected failures  1
# of untested testcases 6
# of unsupported tests  2


Thanks!
--- a/src/libgo/go/net/fd_posix.go	2020-08-03 15:12:53.0 +0200
+++ b/src/libgo/go/net/fd_posix.go	2020-09-24 16:03:50.0 +0200
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows
+// +build aix darwin dragonfly freebsd hurd linux netbsd openbsd solaris windows
 
 package net
 


Re: [PATCH] Updated patches for the port of gccgo to GNU/Hurd

2019-02-12 Thread Ian Lance Taylor
On Mon, Feb 11, 2019 at 1:38 PM Svante Signell  wrote:
>
> On Mon, 2019-02-11 at 10:27 -0800, Ian Lance Taylor wrote:
>
> > It sound like the right fix is to use #ifdef WIFCONTINUED in
> > syscall/wait.c.  If WIFCONTINUED is not defined, the Continued
> > function should always return 0.

> I can also easily submit a patch for WIFCONTINUED returning 0. Problem is I'll
> be AFK for the next week. Maybe this can wait, or you find a solution? 
> Regardinga comm opttion for ps Samuel is the best source.

I've committed this patch that should fix this problem.  Bootstrapped
and tested on x86_64-pc-linux-gnu.

Ian
Index: gcc/go/gofrontend/MERGE
===
--- gcc/go/gofrontend/MERGE (revision 268785)
+++ gcc/go/gofrontend/MERGE (working copy)
@@ -1,4 +1,4 @@
-fc8aa5a46433d6ecba9fd1cd0bee4290c314ca06
+6d03c4c8ca320042bd550d44c0f25575c5311ac2
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/go/syscall/wait.c
===
--- libgo/go/syscall/wait.c (revision 268369)
+++ libgo/go/syscall/wait.c (working copy)
@@ -16,6 +16,10 @@
 #define WCOREDUMP(status) (((status) & 0200) != 0)
 #endif
 
+#ifndef WIFCONTINUED
+#define WIFCONTINUED(x) 0
+#endif
+
 extern _Bool Exited (uint32_t *w)
   __asm__ (GOSYM_PREFIX "syscall.WaitStatus.Exited");
 


Re: [PATCH] Updated patches for the port of gccgo to GNU/Hurd

2019-02-11 Thread Ian Lance Taylor
On Sun, Feb 10, 2019 at 3:40 AM Svante Signell  wrote:
>
> > I've found some problems. Current problem is with the mksysinfo.sh patch. 
> > But
> > there are some other things missing. New patches will be submitted tomorrow.
>
> Attached are three additional patches needed to build libgo on GNU/Hurd:
> src_libgo_mksysinfo.sh.diff
> src_libgo_go_syscall_wait.c.diff
> src_libgo_testsuite_gotest.diff
>
> For the first patch, src_libgo_mksysinfo.sh.diff, I had to go back to the old
> version, using sed -i -e. As written now ${fsid_to_dev} expands to
> fsid_to_dev='-e '\''s/st_fsid/Dev/'\''' resulting in: "sed: -e expression #4,
> char 1: unknown command: `''". Unfortunately, I have not yet been able to 
> modify
> the expansion omitting the single qoutes around the shell variable.

I fixed this a slightly different way, as attached.  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 268605)
+++ gcc/go/gofrontend/MERGE (working copy)
@@ -1,4 +1,4 @@
-9b66264ed6adcf3fd215dbfd125c12b022b7280e
+fc8aa5a46433d6ecba9fd1cd0bee4290c314ca06
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/mksysinfo.sh
===
--- libgo/mksysinfo.sh  (revision 268461)
+++ libgo/mksysinfo.sh  (working copy)
@@ -486,9 +486,9 @@ grep '^type _st_timespec ' gen-sysinfo.g
 
 # 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=
+st_dev='-e s/st_dev/Dev/'
 if grep 'define st_dev st_fsid' gen-sysinfo.go > /dev/null 2>&1; then
-  fsid_to_dev="-e 's/st_fsid/Dev/'"
+  st_dev='-e s/st_fsid/Dev/'
 fi
 
 # The stat type.
@@ -500,8 +500,7 @@ else
   grep '^type _stat ' gen-sysinfo.go
 fi | sed -e 's/type _stat64/type Stat_t/' \
  -e 's/type _stat/type Stat_t/' \
- -e 's/st_dev/Dev/' \
- ${fsid_to_dev} \
+ ${st_dev} \
  -e 's/st_ino/Ino/g' \
  -e 's/st_nlink/Nlink/' \
  -e 's/st_mode/Mode/' \


Re: [PATCH] Updated patches for the port of gccgo to GNU/Hurd

2019-02-11 Thread Svante Signell
On Mon, 2019-02-11 at 10:27 -0800, Ian Lance Taylor wrote:
> On Mon, Feb 11, 2019 at 3:10 AM Svante Signell 
> wrote:
> > On Sun, 2019-02-10 at 22:08 -0800, Ian Lance Taylor wrote:
> > > On Sun, Feb 10, 2019 at 3:41 AM Svante Signell 
> > > wrote:
> > > > On Sat, 2019-02-09 at 23:57 +0100, Svante Signell wrote:
> > > > > On Sat, 2019-02-09 at 14:40 -0800, Ian Lance Taylor wrote:
> > > > > > On Fri, Feb 8, 2019 at 3:07 PM Matthias Klose 
> > > > > > wrote:
> > > > > > > On 07.02.19 06:04, Ian Lance Taylor wrote:
> > > > > > What are the lines before that in the log?  For some reason libtool
> > > > > > is
> > > > > > being invoke with no source files.  The lines before the failing
> > > > > > line
> > > > > > should show an invocation of match.sh that determines the source
> > > > > > files.
> > > > > 
> > > > > Thanks for your job upstreaming the patches!
> > > > > 
> > > > > I've found some problems. Current problem is with the mksysinfo.sh
> > > > > patch.
> > > > > But there are some other things missing. New patches will be submitted
> > > > > tomorrow.
> > > > 
> > > > Attached are three additional patches needed to build libgo on GNU/Hurd:
> > > > src_libgo_mksysinfo.sh.diff
> > > > src_libgo_go_syscall_wait.c.diff
> > > > src_libgo_testsuite_gotest.diff
> > > > 
> > > > For the first patch, src_libgo_mksysinfo.sh.diff, I had to go back to
> > > > the
> > > > old version, using sed -i -e. As written now ${fsid_to_dev} expands to
> > > > fsid_to_dev='-e '\''s/st_fsid/Dev/'\''' resulting in: "sed: -e
> > > > expression
> > > > #4, char 1: unknown command: `''". Unfortunately, I have not yet been
> > > > able
> > > > to modify the expansion omitting the single qoutes around the shell
> > > > variable.
> > > 
> > > I'm sorry, I don't want to use "sed -i".  That loses the original file
> > > and makes it harder to reconstruct what has happened.
> > 
> > What to do then?
> > 
> > > > The second patch, src_libgo_go_syscall_wait.c.diff, is needed since
> > > > WCONTINUED is not defined and is needed for WIFCONTINUED to be defined
> > > > in
> > > > wait.h.
> > > 
> > > I don't understand that.   is a system header file.  Are
> > > you saying that it is impossible to use  and WIFCONTINUED
> > > unless your source code does a #define WCONTINUED before #include'ing
> > > ?  That seems like a bug in the Hurd library code.
> > 
> > The problem is that WCONTINUED is not defined in /usr/include/i386-
> > gnu/bits/waitflags.h on Hurd. Only WNOHANG and WUNTRACED are. That causes
> > WIFCONTINUED not to be defined in /usr/include/i386-gnu/bits/waitstatus.h.
> > As
> > WCONTINUED is not defined, I assume that WIFCONTINUED is not supported.
> > 
> > From waitpid(2):
> > WCONTINUED (since Linux 2.6.10)
> >also return if a stopped child has been resumed by delivery of SIGCONT.
> > 
> > @Samuel: more info?
> > 
> > I think that that call to WIFCONTINUED in libgo/go/syscall/wait.c
> > _Bool
> > Continued (uint32_t *w)
> > {
> >   return WIFCONTINUED (*w) != 0;
> > }
> > 
> > has to be omitted somehow for Hurd.
> 
> It sound like the right fix is to use #ifdef WIFCONTINUED in
> syscall/wait.c.  If WIFCONTINUED is not defined, the Continued
> function should always return 0.

I've got some ideas on how to solve the mksysinfo.sh problem. I just don't have
time to try it out now. The idea is:
fsid_to_dev='s/st_dev/Dev/'
if grep 'define st_dev st_fsid' gen-sysinfo.go > /dev/null 2>&1; then
fsid_to_dev='s/st_fsid/Dev/'
...
remove: -e 's/st_dev/Dev/' \
add:-e ${fsid_to_dev} \


I can also easily submit a patch for WIFCONTINUED returning 0. Problem is I'll
be AFK for the next week. Maybe this can wait, or you find a solution? 
Regardinga comm opttion for ps Samuel is the best source. 

Thanks!



Re: [PATCH] Updated patches for the port of gccgo to GNU/Hurd

2019-02-11 Thread Samuel Thibault
Svante Signell, le lun. 11 févr. 2019 12:10:21 +0100, a ecrit:
> WCONTINUED is not defined, I assume that WIFCONTINUED is not supported.
> 
> From waitpid(2):
> WCONTINUED (since Linux 2.6.10)
>also return if a stopped child has been resumed by delivery of SIGCONT.
> 
> @Samuel: more info?

git grep WCONTINUED .
yields nothing in hurd/proc, so it's probably just not supported yet
indeed.

> > > The third patch, src_libgo_testsuite_gotest.diff, is not strictly needed,
> > > but running the tests the annoying text is displayed: "ps: comm: Unknown
> > > format spec"
> > 
> > I get that "comm" doesn't work, but the change in that patch is simply
> > incorrect.  If you don't pass "comm", the "grep sleep" will never
> > succeed.  If there is no way to support this code on Hurd then we
> > should skip it, not put in a command that can never work.
> 
> OK, let's drop that part then.
> 
> @Samuel: more info?

arg0 can be used instead.

That said, we should implement comm since it's defined by posix, it's
probably a matter of duplicating the line "Arg0" in hurd/libps/spec.c

Samuel


Re: [PATCH] Updated patches for the port of gccgo to GNU/Hurd

2019-02-11 Thread Ian Lance Taylor
On Mon, Feb 11, 2019 at 3:10 AM Svante Signell  wrote:
>
> On Sun, 2019-02-10 at 22:08 -0800, Ian Lance Taylor wrote:
> > On Sun, Feb 10, 2019 at 3:41 AM Svante Signell 
> > wrote:
> > > On Sat, 2019-02-09 at 23:57 +0100, Svante Signell wrote:
> > > > On Sat, 2019-02-09 at 14:40 -0800, Ian Lance Taylor wrote:
> > > > > On Fri, Feb 8, 2019 at 3:07 PM Matthias Klose  wrote:
> > > > > > On 07.02.19 06:04, Ian Lance Taylor wrote:
> > > > > What are the lines before that in the log?  For some reason libtool is
> > > > > being invoke with no source files.  The lines before the failing line
> > > > > should show an invocation of match.sh that determines the source
> > > > > files.
> > > >
> > > > Thanks for your job upstreaming the patches!
> > > >
> > > > I've found some problems. Current problem is with the mksysinfo.sh 
> > > > patch.
> > > > But there are some other things missing. New patches will be submitted
> > > > tomorrow.
> > >
> > > Attached are three additional patches needed to build libgo on GNU/Hurd:
> > > src_libgo_mksysinfo.sh.diff
> > > src_libgo_go_syscall_wait.c.diff
> > > src_libgo_testsuite_gotest.diff
> > >
> > > For the first patch, src_libgo_mksysinfo.sh.diff, I had to go back to the
> > > old version, using sed -i -e. As written now ${fsid_to_dev} expands to
> > > fsid_to_dev='-e '\''s/st_fsid/Dev/'\''' resulting in: "sed: -e expression
> > > #4, char 1: unknown command: `''". Unfortunately, I have not yet been able
> > > to modify the expansion omitting the single qoutes around the shell
> > > variable.
> >
> > I'm sorry, I don't want to use "sed -i".  That loses the original file
> > and makes it harder to reconstruct what has happened.
>
> What to do then?
>
> > > The second patch, src_libgo_go_syscall_wait.c.diff, is needed since
> > > WCONTINUED is not defined and is needed for WIFCONTINUED to be defined in
> > > wait.h.
> >
> > I don't understand that.   is a system header file.  Are
> > you saying that it is impossible to use  and WIFCONTINUED
> > unless your source code does a #define WCONTINUED before #include'ing
> > ?  That seems like a bug in the Hurd library code.
>
> The problem is that WCONTINUED is not defined in /usr/include/i386-
> gnu/bits/waitflags.h on Hurd. Only WNOHANG and WUNTRACED are. That causes
> WIFCONTINUED not to be defined in /usr/include/i386-gnu/bits/waitstatus.h. As
> WCONTINUED is not defined, I assume that WIFCONTINUED is not supported.
>
> From waitpid(2):
> WCONTINUED (since Linux 2.6.10)
>also return if a stopped child has been resumed by delivery of SIGCONT.
>
> @Samuel: more info?
>
> I think that that call to WIFCONTINUED in libgo/go/syscall/wait.c
> _Bool
> Continued (uint32_t *w)
> {
>   return WIFCONTINUED (*w) != 0;
> }
>
> has to be omitted somehow for Hurd.

It sound like the right fix is to use #ifdef WIFCONTINUED in
syscall/wait.c.  If WIFCONTINUED is not defined, the Continued
function should always return 0.

Ian


Re: [PATCH] Updated patches for the port of gccgo to GNU/Hurd

2019-02-11 Thread Svante Signell
On Sun, 2019-02-10 at 22:08 -0800, Ian Lance Taylor wrote:
> On Sun, Feb 10, 2019 at 3:41 AM Svante Signell 
> wrote:
> > On Sat, 2019-02-09 at 23:57 +0100, Svante Signell wrote:
> > > On Sat, 2019-02-09 at 14:40 -0800, Ian Lance Taylor wrote:
> > > > On Fri, Feb 8, 2019 at 3:07 PM Matthias Klose  wrote:
> > > > > On 07.02.19 06:04, Ian Lance Taylor wrote:
> > > > What are the lines before that in the log?  For some reason libtool is
> > > > being invoke with no source files.  The lines before the failing line
> > > > should show an invocation of match.sh that determines the source
> > > > files.
> > > 
> > > Thanks for your job upstreaming the patches!
> > > 
> > > I've found some problems. Current problem is with the mksysinfo.sh patch.
> > > But there are some other things missing. New patches will be submitted
> > > tomorrow.
> > 
> > Attached are three additional patches needed to build libgo on GNU/Hurd:
> > src_libgo_mksysinfo.sh.diff
> > src_libgo_go_syscall_wait.c.diff
> > src_libgo_testsuite_gotest.diff
> > 
> > For the first patch, src_libgo_mksysinfo.sh.diff, I had to go back to the
> > old version, using sed -i -e. As written now ${fsid_to_dev} expands to
> > fsid_to_dev='-e '\''s/st_fsid/Dev/'\''' resulting in: "sed: -e expression
> > #4, char 1: unknown command: `''". Unfortunately, I have not yet been able
> > to modify the expansion omitting the single qoutes around the shell
> > variable.
> 
> I'm sorry, I don't want to use "sed -i".  That loses the original file
> and makes it harder to reconstruct what has happened.

What to do then?

> > The second patch, src_libgo_go_syscall_wait.c.diff, is needed since
> > WCONTINUED is not defined and is needed for WIFCONTINUED to be defined in
> > wait.h.
> 
> I don't understand that.   is a system header file.  Are
> you saying that it is impossible to use  and WIFCONTINUED
> unless your source code does a #define WCONTINUED before #include'ing
> ?  That seems like a bug in the Hurd library code.

The problem is that WCONTINUED is not defined in /usr/include/i386-
gnu/bits/waitflags.h on Hurd. Only WNOHANG and WUNTRACED are. That causes
WIFCONTINUED not to be defined in /usr/include/i386-gnu/bits/waitstatus.h. As
WCONTINUED is not defined, I assume that WIFCONTINUED is not supported.

>From waitpid(2):
WCONTINUED (since Linux 2.6.10)
   also return if a stopped child has been resumed by delivery of SIGCONT.

@Samuel: more info?

I think that that call to WIFCONTINUED in libgo/go/syscall/wait.c
_Bool
Continued (uint32_t *w)
{
  return WIFCONTINUED (*w) != 0;
}

has to be omitted somehow for Hurd.

> > The third patch, src_libgo_testsuite_gotest.diff, is not strictly needed,
> > but running the tests the annoying text is displayed: "ps: comm: Unknown
> > format spec"
> 
> I get that "comm" doesn't work, but the change in that patch is simply
> incorrect.  If you don't pass "comm", the "grep sleep" will never
> succeed.  If there is no way to support this code on Hurd then we
> should skip it, not put in a command that can never work.

OK, let's drop that part then.

@Samuel: more info?




Re: [PATCH] Updated patches for the port of gccgo to GNU/Hurd

2019-02-10 Thread Ian Lance Taylor
On Sun, Feb 10, 2019 at 3:41 AM Svante Signell  wrote:
>
> On Sat, 2019-02-09 at 23:57 +0100, Svante Signell wrote:
> > On Sat, 2019-02-09 at 14:40 -0800, Ian Lance Taylor wrote:
> > > On Fri, Feb 8, 2019 at 3:07 PM Matthias Klose  wrote:
> > > > On 07.02.19 06:04, Ian Lance Taylor wrote:
> > > What are the lines before that in the log?  For some reason libtool is
> > > being invoke with no source files.  The lines before the failing line
> > > should show an invocation of match.sh that determines the source
> > > files.
> >
> > Thanks for your job upstreaming the patches!
> >
> > I've found some problems. Current problem is with the mksysinfo.sh patch. 
> > But
> > there are some other things missing. New patches will be submitted tomorrow.
>
> Attached are three additional patches needed to build libgo on GNU/Hurd:
> src_libgo_mksysinfo.sh.diff
> src_libgo_go_syscall_wait.c.diff
> src_libgo_testsuite_gotest.diff
>
> For the first patch, src_libgo_mksysinfo.sh.diff, I had to go back to the old
> version, using sed -i -e. As written now ${fsid_to_dev} expands to
> fsid_to_dev='-e '\''s/st_fsid/Dev/'\''' resulting in: "sed: -e expression #4,
> char 1: unknown command: `''". Unfortunately, I have not yet been able to 
> modify
> the expansion omitting the single qoutes around the shell variable.

I'm sorry, I don't want to use "sed -i".  That loses the original file
and makes it harder to reconstruct what has happened.

> The second patch, src_libgo_go_syscall_wait.c.diff, is needed since WCONTINUED
> is not defined and is needed for WIFCONTINUED to be defined in wait.h.

I don't understand that.   is a system header file.  Are
you saying that it is impossible to use  and WIFCONTINUED
unless your source code does a #define WCONTINUED before #include'ing
?  That seems like a bug in the Hurd library code.

> The third patch, src_libgo_testsuite_gotest.diff, is not strictly needed, but
> running the tests the annoying text is displayed: "ps: comm: Unknown format
> spec"

I get that "comm" doesn't work, but the change in that patch is simply
incorrect.  If you don't pass "comm", the "grep sleep" will never
succeed.  If there is no way to support this code on Hurd then we
should skip it, not put in a command that can never work.

Ian


Re: [PATCH] Updated patches for the port of gccgo to GNU/Hurd

2019-02-10 Thread Svante Signell
On Sat, 2019-02-09 at 23:57 +0100, Svante Signell wrote:
> On Sat, 2019-02-09 at 14:40 -0800, Ian Lance Taylor wrote:
> > On Fri, Feb 8, 2019 at 3:07 PM Matthias Klose  wrote:
> > > On 07.02.19 06:04, Ian Lance Taylor wrote:
> > What are the lines before that in the log?  For some reason libtool is
> > being invoke with no source files.  The lines before the failing line
> > should show an invocation of match.sh that determines the source
> > files.
> 
> Thanks for your job upstreaming the patches!
> 
> I've found some problems. Current problem is with the mksysinfo.sh patch. But
> there are some other things missing. New patches will be submitted tomorrow. 

Attached are three additional patches needed to build libgo on GNU/Hurd:
src_libgo_mksysinfo.sh.diff
src_libgo_go_syscall_wait.c.diff
src_libgo_testsuite_gotest.diff

For the first patch, src_libgo_mksysinfo.sh.diff, I had to go back to the old
version, using sed -i -e. As written now ${fsid_to_dev} expands to 
fsid_to_dev='-e '\''s/st_fsid/Dev/'\''' resulting in: "sed: -e expression #4,
char 1: unknown command: `''". Unfortunately, I have not yet been able to modify
the expansion omitting the single qoutes around the shell variable.

The second patch, src_libgo_go_syscall_wait.c.diff, is needed since WCONTINUED
is not defined and is needed for WIFCONTINUED to be defined in wait.h.

The third patch, src_libgo_testsuite_gotest.diff, is not strictly needed, but
running the tests the annoying text is displayed: "ps: comm: Unknown format
spec"

Thanks!
Index: gcc-9-9-20190208/src/libgo/go/syscall/wait.c
===
--- gcc-9-9-20190208.orig/src/libgo/go/syscall/wait.c
+++ gcc-9-9-20190208/src/libgo/go/syscall/wait.c
@@ -8,6 +8,13 @@
OS-independent.  */
 
 #include 
+
+/* WCONTINUED is not defined on GNU/Hurd */
+#ifdef __GNU__
+#ifndef WCONTINUED
+#define WCONTINUED 0
+#endif
+#endif
 #include 
 
 #include "runtime.h"
Index: gcc-9-9-20190208/src/libgo/mksysinfo.sh
===
--- gcc-9-9-20190208.orig/src/libgo/mksysinfo.sh
+++ gcc-9-9-20190208/src/libgo/mksysinfo.sh
@@ -486,9 +486,8 @@ grep '^type _st_timespec ' gen-sysinfo.g
 
 # 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/'"
+  sed -i -e 's/; st_fsid/; st_dev/' gen-sysinfo.go
 fi
 
 # The stat type.
@@ -501,7 +500,6 @@ 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/' \
libgo/ChangeLog

2018-10-20  Svante Signell 
  * libgo/testsuite/gotest: Remove ps -o comm option for GNU/Hurd.

Index: gcc-9-9-20190208/src/libgo/testsuite/gotest
===
--- gcc-9-9-20190208.orig/src/libgo/testsuite/gotest
+++ gcc-9-9-20190208/src/libgo/testsuite/gotest
@@ -650,7 +650,11 @@ xno)
 		wait $pid
 		status=$?
 		if ! test -f gotest-timeout; then
-		sleeppid=`ps -o pid,ppid,comm | grep " $alarmpid " | grep sleep | sed -e 's/ *\([0-9]*\) .*$/\1/'`
+		if test "$goos" = "hurd"; then
+			sleeppid=`ps -o pid,ppid | grep " $alarmpid " | grep sleep | sed -e 's/ *\([0-9]*\) .*$/\1/'`
+		else
+			sleeppid=`ps -o pid,ppid,comm | grep " $alarmpid " | grep sleep | sed -e 's/ *\([0-9]*\) .*$/\1/'`
+		fi
 		kill $alarmpid
 		wait $alarmpid
 		if test "$sleeppid" != ""; then


Re: [PATCH] Updated patches for the port of gccgo to GNU/Hurd

2019-02-09 Thread Svante Signell
On Sat, 2019-02-09 at 14:40 -0800, Ian Lance Taylor wrote:
> On Fri, Feb 8, 2019 at 3:07 PM Matthias Klose  wrote:
> > On 07.02.19 06:04, Ian Lance Taylor wrote:

> What are the lines before that in the log?  For some reason libtool is
> being invoke with no source files.  The lines before the failing line
> should show an invocation of match.sh that determines the source
> files.

Thanks for your job upstreaming the patches!

I've found some problems. Current problem is with the mksysinfo.sh patch. But
there are some other things missing. New patches will be submitted tomorrow. 

Thanks!



Re: [PATCH] Updated patches for the port of gccgo to GNU/Hurd

2019-02-09 Thread Ian Lance Taylor
On Fri, Feb 8, 2019 at 3:07 PM Matthias Klose  wrote:
>
> On 07.02.19 06:04, Ian Lance Taylor wrote:
> > On Thu, Jan 31, 2019 at 7:40 AM Svante Signell  
> > wrote:
> >>
> >> As advised by the Debian gcc maintainer Matthias Klose and golang
> >> developer Ian Lance Taylor I'm re-submitting the patches for
> >> the port of gccgo to GNU/Hurd again. Now GOOS value is changed from gnu
> >> to hurd as requested.
> >>
> >> The 12 patches are:
> >> src_libgo_build.diff
> >> src_libgo_runtime.diff
> >> src_libgo_go_crypto.diff
> >> src_libgo_go_internal.diff
> >> src_libgo_go_net.diff
> >> src_libgo_go_os.diff
> >> src_libgo_go_runtime.diff
> >> src_libgo_go_syscall.diff
> >> src_libgo_go_test.diff
> >>
> >> src_libgo_testsuite_gotest.diff
> >> add-hurd-to-libgo-headers.diff
> >> add-hurd-to-libgo-test-headers.diff
> >
> > Thanks.  I've committed versions of all of these patches other than
> > src_libgo_testsuite_gotest.diff.  I omitted that one because as far as
> > I can tell it won't work.  While the original code may not run on the
> > Hurd, the modified version won't work.
> >
> > I made various changes, and I'm sure I broke some things.  Take a look
> > at GCC trunk and see how it seems.
>
> libtool: compile:  /<>/build/./gcc/gccgo
> -B/<>/build/./gcc/ -B/usr/i686-gnu/bin/ -B/usr/i6
> 86-gnu/lib/ -isystem /usr/i686-gnu/include -isystem /usr/i686-gnu/sys-include
> -isystem /<>/build/sys-in
> clude -fchecking=1 -minline-all-stringops -O2 -g -I . -c -fgo-pkgpath=syscall
> -fPIC -o .libs/syscall.o
> gccgo: fatal error: no input files
> compilation terminated.
> Makefile:2844: recipe for target 'syscall.lo' failed
> make[6]: *** [syscall.lo] Error 1
> make[6]: Leaving directory '/<>/build/i686-gnu/libgo'
> Makefile:2242: recipe for target 'all-recursive' failed
> make[5]: *** [all-recursive] Error 1
> make[5]: Leaving directory '/<>/build/i686-gnu/libgo'
> Makefile:1167: recipe for target 'all' failed
> make[4]: *** [all] Error 2
> make[4]: Leaving directory '/<>/build/i686-gnu/libgo'
> Makefile:20078: recipe for target 'all-target-libgo' failed
> make[3]: *** [all-target-libgo] Error 2
> make[3]: Leaving directory '/<>/build'
> Makefile:24129: recipe for target 'bootstrap' failed
> make[2]: *** [bootstrap] Error 2

What are the lines before that in the log?  For some reason libtool is
being invoke with no source files.  The lines before the failing line
should show an invocation of match.sh that determines the source
files.

Ian


Re: [PATCH] Updated patches for the port of gccgo to GNU/Hurd

2019-02-08 Thread Matthias Klose
On 07.02.19 06:04, Ian Lance Taylor wrote:
> On Thu, Jan 31, 2019 at 7:40 AM Svante Signell  
> wrote:
>>
>> As advised by the Debian gcc maintainer Matthias Klose and golang
>> developer Ian Lance Taylor I'm re-submitting the patches for
>> the port of gccgo to GNU/Hurd again. Now GOOS value is changed from gnu
>> to hurd as requested.
>>
>> The 12 patches are:
>> src_libgo_build.diff
>> src_libgo_runtime.diff
>> src_libgo_go_crypto.diff
>> src_libgo_go_internal.diff
>> src_libgo_go_net.diff
>> src_libgo_go_os.diff
>> src_libgo_go_runtime.diff
>> src_libgo_go_syscall.diff
>> src_libgo_go_test.diff
>>
>> src_libgo_testsuite_gotest.diff
>> add-hurd-to-libgo-headers.diff
>> add-hurd-to-libgo-test-headers.diff
> 
> Thanks.  I've committed versions of all of these patches other than
> src_libgo_testsuite_gotest.diff.  I omitted that one because as far as
> I can tell it won't work.  While the original code may not run on the
> Hurd, the modified version won't work.
> 
> I made various changes, and I'm sure I broke some things.  Take a look
> at GCC trunk and see how it seems.

libtool: compile:  /<>/build/./gcc/gccgo
-B/<>/build/./gcc/ -B/usr/i686-gnu/bin/ -B/usr/i6
86-gnu/lib/ -isystem /usr/i686-gnu/include -isystem /usr/i686-gnu/sys-include
-isystem /<>/build/sys-in
clude -fchecking=1 -minline-all-stringops -O2 -g -I . -c -fgo-pkgpath=syscall
-fPIC -o .libs/syscall.o
gccgo: fatal error: no input files
compilation terminated.
Makefile:2844: recipe for target 'syscall.lo' failed
make[6]: *** [syscall.lo] Error 1
make[6]: Leaving directory '/<>/build/i686-gnu/libgo'
Makefile:2242: recipe for target 'all-recursive' failed
make[5]: *** [all-recursive] Error 1
make[5]: Leaving directory '/<>/build/i686-gnu/libgo'
Makefile:1167: recipe for target 'all' failed
make[4]: *** [all] Error 2
make[4]: Leaving directory '/<>/build/i686-gnu/libgo'
Makefile:20078: recipe for target 'all-target-libgo' failed
make[3]: *** [all-target-libgo] Error 2
make[3]: Leaving directory '/<>/build'
Makefile:24129: recipe for target 'bootstrap' failed
make[2]: *** [bootstrap] Error 2



Re: [PATCH] Updated patches for the port of gccgo to GNU/Hurd

2019-02-06 Thread Ian Lance Taylor
On Thu, Jan 31, 2019 at 7:40 AM Svante Signell  wrote:
>
> As advised by the Debian gcc maintainer Matthias Klose and golang
> developer Ian Lance Taylor I'm re-submitting the patches for
> the port of gccgo to GNU/Hurd again. Now GOOS value is changed from gnu
> to hurd as requested.
>
> The 12 patches are:
> src_libgo_build.diff
> src_libgo_runtime.diff
> src_libgo_go_crypto.diff
> src_libgo_go_internal.diff
> src_libgo_go_net.diff
> src_libgo_go_os.diff
> src_libgo_go_runtime.diff
> src_libgo_go_syscall.diff
> src_libgo_go_test.diff
>
> src_libgo_testsuite_gotest.diff
> add-hurd-to-libgo-headers.diff
> add-hurd-to-libgo-test-headers.diff

Thanks.  I've committed versions of all of these patches other than
src_libgo_testsuite_gotest.diff.  I omitted that one because as far as
I can tell it won't work.  While the original code may not run on the
Hurd, the modified version won't work.

I made various changes, and I'm sure I broke some things.  Take a look
at GCC trunk and see how it seems.

Ian


Re: GOOS updated: Port of gccgo to GNU/Hurd

2018-11-05 Thread Ian Lance Taylor
On Sat, Nov 3, 2018 at 9:03 AM, Svante Signell  wrote:
> ping, no feedback so far, is anything missing/are the patches rejected?

I haven't had time to look at them yet.

As I've probably said before you will get a faster response if you are
able to follow the contribution guidelines described at
https://golang.org/doc/contribute.html .  Absent that it's going to
have to wait.  I have promised to look at these patches before the GCC
9 release.

Ian


> On Sat, 2018-10-27 at 20:43 +0200, Svante Signell wrote:
>> Hello,
>>
>> As advised by the Debian gcc maintainer Matthias Klose and golang
>> developer Ian Lance Taylor I'm (re-)submitting the patches for
>> the port of gccgo to GNU/Hurd again. Now GOOS value is changed from
>> gnu
>> to hurd as requested.
>>
>> The 13 patches are:
>> src_gcc_config_i386_gnu.h.diff
>> src_libgo_build.diff
>> src_libgo_go_crypto.diff
>> src_libgo_go_go_build_syslist.go.diff
>> src_libgo_go_net.diff
>> src_libgo_go_os.diff
>> src_libgo_go_runtime.diff
>> src_libgo_go_syscall.diff
>> src_libgo_go_syscall_syscall_gnu_test.go.diff
>> src_libgo_runtime.diff
>> src_libgo_testsuite_gotest.diff
>> add-gnu-to-libgo-headers.diff
>> add-gnu-to-libgo-test-headers.diff
>>
>> Preliminary ChangeLog entries are included in each patch.
>>
>> With them the latest the latest Debian gcc-snapshot (20181019-1) has
>> been successfully built. Test results for libgo and go:
>>
>> === libgo Summary ===
>>
>> # of expected passes162
>> # of unexpected failures21
>>
>> === go Summary ===
>>
>> # of expected passes7394
>> # of unexpected failures10
>> # of expected failures  1
>> # of untested testcases 7
>> # of unsupported tests  2
>>
>> Thanks!


Re: GOOS updated: Port of gccgo to GNU/Hurd

2018-11-03 Thread Svante Signell
ping, no feedback so far, is anything missing/are the patches rejected?

On Sat, 2018-10-27 at 20:43 +0200, Svante Signell wrote:
> Hello,
> 
> As advised by the Debian gcc maintainer Matthias Klose and golang
> developer Ian Lance Taylor I'm (re-)submitting the patches for
> the port of gccgo to GNU/Hurd again. Now GOOS value is changed from
> gnu
> to hurd as requested.
> 
> The 13 patches are:
> src_gcc_config_i386_gnu.h.diff
> src_libgo_build.diff
> src_libgo_go_crypto.diff
> src_libgo_go_go_build_syslist.go.diff
> src_libgo_go_net.diff
> src_libgo_go_os.diff
> src_libgo_go_runtime.diff
> src_libgo_go_syscall.diff
> src_libgo_go_syscall_syscall_gnu_test.go.diff
> src_libgo_runtime.diff
> src_libgo_testsuite_gotest.diff
> add-gnu-to-libgo-headers.diff
> add-gnu-to-libgo-test-headers.diff
> 
> Preliminary ChangeLog entries are included in each patch.
> 
> With them the latest the latest Debian gcc-snapshot (20181019-1) has
> been successfully built. Test results for libgo and go:
> 
> === libgo Summary ===
> 
> # of expected passes162
> # of unexpected failures21
> 
> === go Summary ===
> 
> # of expected passes7394
> # of unexpected failures10
> # of expected failures  1
> # of untested testcases 7
> # of unsupported tests  2
> 
> Thanks!


Re: Port of gccgo to GNU/Hurd

2018-10-22 Thread Svante Signell
On Mon, 2018-10-22 at 11:15 +0200, Svante Signell wrote:
> Hello,
> 
> As advised by the Debian gcc maintainer Matthias Klose and golang
> developer Ian Lance Taylor (Cc:ed) I'm (re-)submitting the patches
> for the port of gccgo to GNU/Hurd.
> 
> The 13 patches are:

Due to some editing errors this patch had to be updated:
> src_libgo_go_syscall_syscall_gnu_test.go.diff


Thanks!libgo/ChangeLog

2018-10-20  Svante Signell 
  * libgo/go/syscall/syscall_gnu_test.go: New file,
  derived from syscall_unix_test.go. Flock_t members
  Type and Whence are int32 instead of int16.
  
Index: gcc-snapshot-20181019-1.1/src/libgo/go/syscall/syscall_gnu_test.go
===
--- /dev/null
+++ gcc-snapshot-20181019-1.1/src/libgo/go/syscall/syscall_gnu_test.go
@@ -0,0 +1,357 @@
+// Copyright 2013 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.
+// This file is identical to syscall_unix_test.go except that
+// Flock_t members Type and Whence are int32 instead of int16.
+
+// +build gnu
+
+package syscall_test
+
+import (
+	"flag"
+	"fmt"
+	"internal/testenv"
+	"io"
+	"io/ioutil"
+	"net"
+	"os"
+	"os/exec"
+	"path/filepath"
+	"runtime"
+	"syscall"
+	"testing"
+	"time"
+)
+
+// Tests that below functions, structures and constants are consistent
+// on all Unix-like systems.
+func _() {
+	// program scheduling priority functions and constants
+	var (
+		_ func(int, int, int) error   = syscall.Setpriority
+		_ func(int, int) (int, error) = syscall.Getpriority
+	)
+	const (
+		_ int = syscall.PRIO_USER
+		_ int = syscall.PRIO_PROCESS
+		_ int = syscall.PRIO_PGRP
+	)
+
+	// termios constants
+	const (
+		_ int = syscall.TCIFLUSH
+		_ int = syscall.TCIOFLUSH
+		_ int = syscall.TCOFLUSH
+	)
+
+	// fcntl file locking structure and constants
+	var (
+		_ = syscall.Flock_t{
+			Type:   int32(0),
+			Whence: int32(0),
+			Start:  int64(0),
+			Len:int64(0),
+			Pid:int32(0),
+		}
+	)
+	const (
+		_ = syscall.F_GETLK
+		_ = syscall.F_SETLK
+		_ = syscall.F_SETLKW
+	)
+}
+
+// TestFcntlFlock tests whether the file locking structure matches
+// the calling convention of each kernel.
+// On some Linux systems, glibc uses another set of values for the
+// commands and translates them to the correct value that the kernel
+// expects just before the actual fcntl syscall. As Go uses raw
+// syscalls directly, it must use the real value, not the glibc value.
+// Thus this test also verifies that the Flock_t structure can be
+// roundtripped with F_SETLK and F_GETLK.
+func TestFcntlFlock(t *testing.T) {
+	if runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") {
+		t.Skip("skipping; no child processes allowed on iOS")
+	}
+	flock := syscall.Flock_t{
+		Type:  syscall.F_WRLCK,
+		Start: 31415, Len: 271828, Whence: 1,
+	}
+	if os.Getenv("GO_WANT_HELPER_PROCESS") == "" {
+		// parent
+		tempDir, err := ioutil.TempDir("", "TestFcntlFlock")
+		if err != nil {
+			t.Fatalf("Failed to create temp dir: %v", err)
+		}
+		name := filepath.Join(tempDir, "TestFcntlFlock")
+		fd, err := syscall.Open(name, syscall.O_CREAT|syscall.O_RDWR|syscall.O_CLOEXEC, 0)
+		if err != nil {
+			t.Fatalf("Open failed: %v", err)
+		}
+		defer os.RemoveAll(tempDir)
+		defer syscall.Close(fd)
+		if err := syscall.Ftruncate(fd, 1<<20); err != nil {
+			t.Fatalf("Ftruncate(1<<20) failed: %v", err)
+		}
+		if err := syscall.FcntlFlock(uintptr(fd), syscall.F_SETLK, &flock); err != nil {
+			t.Fatalf("FcntlFlock(F_SETLK) failed: %v", err)
+		}
+		cmd := exec.Command(os.Args[0], "-test.run=^TestFcntlFlock$")
+		cmd.Env = append(os.Environ(), "GO_WANT_HELPER_PROCESS=1")
+		cmd.ExtraFiles = []*os.File{os.NewFile(uintptr(fd), name)}
+		out, err := cmd.CombinedOutput()
+		if len(out) > 0 || err != nil {
+			t.Fatalf("child process: %q, %v", out, err)
+		}
+	} else {
+		// child
+		got := flock
+		// make sure the child lock is conflicting with the parent lock
+		got.Start--
+		got.Len++
+		if err := syscall.FcntlFlock(3, syscall.F_GETLK, &got); err != nil {
+			t.Fatalf("FcntlFlock(F_GETLK) failed: %v", err)
+		}
+		flock.Pid = int32(syscall.Getppid())
+		// Linux kernel always set Whence to 0
+		flock.Whence = 0
+		if got.Type == flock.Type && got.Start == flock.Start && got.Len == flock.Len && got.Pid == flock.Pid && got.Whence == flock.Whence {
+			os.Exit(0)
+		}
+		t.Fatalf("FcntlFlock got %v, want %v", got, flock)
+	}
+}
+
+// TestPassFD tests passing a file descriptor over a Unix socket.
+//
+