Re: Bug#1005297: gcc-12-12-20220214: FTBFS on hurd-i386; Was: gcc-12-12-20220206: FTBFS on hurd-i386

2022-02-18 Thread Svante Signell via Gcc-bugs
retitle 1005297 gcc-12-12-29229214: FTBFS on hurd-i386
thanks

On Thu, 2022-02-10 at 19:34 +0100, Svante Signell wrote:
> Source: gcc-12
> Version: 12_12-20220206-1
> Severity: important
> Tags: patch
> User: debian-h...@lists.debian.org
> Usertags: hurd

Hi again,

Attached are patches to successfully build gcc-12-12-20220214-1 from source:

debian_rules.patch.patch: Adds hurd-specific patches to to debian/rules.patch.
gcc_config_gnu.h.diff: Re-enables split-stack support.

The patches below are needed for a successful build of libgo.so.21.0.0:
libgo_go_net_unixsock_readmsg_cloexec.go.diff
libgo_go_runtime_netpoll_hurd.go.diff
libgo_go_runtime_os_hurd.go.diff
libgo_go_syscall_exec_bsd.go.diff
libgo_go_syscall_exec_hurd.go.diff
libgo_go_os_user_cgo_listgroups_unix.go.diff
libgo_go_os_user_getgrouplist_unix.go.diff
libgo_go_internal_testenv_testenv_unix.go.diff
libgo_go_os_exec_internal_fdtest_exists_unix.go.diff

Makefile.in.diff: This patch is modified from the upstream patch
src_Makefile.in.diff since the Debian-specific patch gm2.diff makes changes to
src/Makefile.in before Makefile.in.diff is applied.

All patches have been submitted upstream in 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104290

The patch, libgo_go_net_unixsock_readmsg_cloexec.go.diff, has already been
committed upstream by Ian.

Thanks!
--- a/debian/rules.patch	2022-02-15 23:07:04.0 +0100
+++ b/debian/rules.patch	2022-02-15 23:14:51.0 +0100
@@ -192,6 +192,17 @@
 
 ifeq ($(DEB_TARGET_ARCH_OS),hurd)
   debian_patches += hurd-changes
+  debian_patches += gcc_config_gnu.h
+  debian_patches += libgo_go_net_unixsock_readmsg_cloexec.go
+  debian_patches += libgo_go_runtime_netpoll_hurd.go
+  debian_patches += libgo_go_runtime_os_hurd.go
+  debian_patches += libgo_go_syscall_exec_bsd.go
+  debian_patches += libgo_go_syscall_exec_hurd.go
+  debian_patches += libgo_go_os_user_cgo_listgroups_unix.go
+  debian_patches += libgo_go_os_user_getgrouplist_unix.go
+  debian_patches += libgo_go_internal_testenv_testenv_unix.go
+  debian_patches += libgo_go_os_exec_internal_fdtest_exists_unix.go
+  debian-patches += Makefile.in
 endif
 
 debian_patches += gcc-ice-dump
--- a/src/gcc/config/gnu.h	2022-02-06 11:59:41.0 +0100
+++ b/src/gcc/config/gnu.h	2022-02-06 12:00:19.0 +0100
@@ -19,6 +19,9 @@
 along with GCC.  If not, see .
 */
 
+#define OPTION_GLIBC_P(opts)	(DEFAULT_LIBC == LIBC_GLIBC)
+#define OPTION_GLIBC		OPTION_GLIBC_P (&global_options)
+
 #undef GNU_USER_TARGET_OS_CPP_BUILTINS
 #define GNU_USER_TARGET_OS_CPP_BUILTINS()		\
 do {	\
--- a/src/libgo/go/internal/testenv/testenv_unix.go	2022-02-14 03:23:21.0 +0100
+++ b/src/libgo/go/internal/testenv/testenv_unix.go	2022-02-15 13:06:16.0 +0100
@@ -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 || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
+//go:build aix || darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd || solaris
 
 package testenv
 
--- a/src/libgo/go/net/unixsock_readmsg_cloexec.go	2022-02-15 00:27:45.0 +0100
+++ b/src/libgo/go/net/unixsock_readmsg_cloexec.go	2022-02-15 00:29:01.0 +0100
@@ -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 || darwin || freebsd || solaris
+//go:build aix || darwin || freebsd || hurd || solaris
 
 package net
 
--- a/src/libgo/go/os/exec/internal/fdtest/exists_unix.go	2022-02-14 03:23:21.0 +0100
+++ b/src/libgo/go/os/exec/internal/fdtest/exists_unix.go	2022-02-15 13:38:42.0 +0100
@@ -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 || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
+//go:build aix || darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd || solaris
 
 // Package fdtest provides test helpers for working with file descriptors across exec.
 package fdtest
--- a/src/libgo/go/os/user/cgo_listgroups_unix.go	2022-02-14 03:23:22.0 +0100
+++ b/src/libgo/go/os/user/cgo_listgroups_unix.go	2022-02-15 12:13:35.0 +0100
@@ -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 (dragonfly || darwin || freebsd || (!android && linux) || netbsd || openbsd || (solaris && !illumos)) && cgo && !osusergo
+//go:build (dragonfly || darwin || freebsd || hurd || (!android && linux) || netbsd || openbsd || (solaris && !illumos)) && cgo && !osusergo
 
 package user
 
--- a/src/libgo/go/os/user/getgrouplist_unix.go	2022-02-14 03:23:22.0 +0100
+++ b/src/libgo/go/os/user/getgrouplist_unix.go	2022-02-15 12:17:12.0 +0100
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be 

gcc-12-12-20220206: FTBFS on hurd-i386

2022-02-10 Thread Svante Signell via Gcc-bugs
Source: gcc-12
Version: 12_12-20220206-1
Severity: important
Tags: patch
User: debian-h...@lists.debian.org
Usertags: hurd

Hi,

gcc-12-12-20220206 in experimental FTBFS on hurd-i386 due to missing
patches for gccgo, gnu.h and an yet unresolved bug in src/Makefile.in.
Attached are patches needed for a successful build.

This bug has been reported by Mathias and assigned upstream, see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104290
but no patches are yet committed.

debian_rules.patch.patch patches debian/rules.patch to include the two
patches: gcc_config_gnu.h.diff fixing the split-stack problem when
building gotools and libgo_go_net_unixsock_readmsg_cloexec.go.diff
fixing the build of libgo. The last patch src_Makefile.in.patch, is for
src/Makefile.in moving 
all-target-libgo: maybe-all-target-libbacktrace
all-target-libgo: maybe-all-target-libatomic
outside of the
@unless gcc-bootstrap
@endunless gcc-bootstrap
pair. This patch is not part of the debian_rules.patch since I'm unsure
if this a patch is needed for all architectures or GNU/Hurd only.

BTW: Creating a new src/Makefile.in by
(cd src; autogen Makefile.def) does still create a buggy Makefile.in.
The reason of why some dependencies are within the @unless/@endunless
pair is still unknown. configure{,.ac} has the following note:

# Do not nest @if/@endif or @unless/@endunless pairs, because
# configure will not warn you at all.

Googling around did not help much, I've found no documentation of it's
use and how to encounter it.

Just a reflection: Matthias you are really doing a great job with the
gcc releases: Kudos!

Thanks!

--- a/debian/rules.patch	2022-01-26 11:49:06.0 +0100
+++ b/debian/rules.patch	2022-02-02 13:08:44.0 +0100
@@ -192,6 +192,8 @@
 
 ifeq ($(DEB_TARGET_ARCH_OS),hurd)
   debian_patches += hurd-changes
+  debian_patches += gcc_config_gnu.h
+  debian_patches += libgo_go_net_unixsock_readmsg_cloexec.go
 endif
 
 debian_patches += gcc-ice-dump
--- a/src/gcc/config/gnu.h	2022-02-06 11:59:41.0 +0100
+++ b/src/gcc/config/gnu.h	2022-02-06 12:00:19.0 +0100
@@ -19,6 +19,9 @@
 along with GCC.  If not, see .
 */
 
+#define OPTION_GLIBC_P(opts)	(DEFAULT_LIBC == LIBC_GLIBC)
+#define OPTION_GLIBC		OPTION_GLIBC_P (&global_options)
+
 #undef GNU_USER_TARGET_OS_CPP_BUILTINS
 #define GNU_USER_TARGET_OS_CPP_BUILTINS()		\
 do {	\
--- a/src/libgo/go/net/unixsock_readmsg_cloexec.go	2021-08-25 14:06:31.0 +0200
+++ b/src/libgo/go/net/unixsock_readmsg_cloexec.go	2022-02-01 16:10:01.0 +0100
@@ -3,7 +3,7 @@
 // license that can be found in the LICENSE file.
 
 //go:build aix || darwin || freebsd || solaris
-// +build aix darwin freebsd solaris
+// +build aix darwin freebsd hurd solaris
 
 package net
 
--- a/src/Makefile.in	2022-02-08 23:25:36.0 +0100
+++ b/src/Makefile.in	2022-02-09 12:37:13.0 +0100
@@ -67372,6 +67372,8 @@
 all-m4: maybe-all-build-texinfo
 configure-target-libgo: maybe-configure-target-libffi
 all-target-libgo: maybe-all-target-libffi
+all-target-libgo: maybe-all-target-libbacktrace
+all-target-libgo: maybe-all-target-libatomic
 configure-target-libphobos: maybe-configure-target-libbacktrace
 configure-stage1-target-libphobos: maybe-configure-stage1-target-libbacktrace
 configure-stage2-target-libphobos: maybe-configure-stage2-target-libbacktrace
@@ -67541,8 +67543,6 @@
 configure-target-fastjar: maybe-configure-target-zlib
 all-target-fastjar: maybe-all-target-zlib
 configure-target-libgo: maybe-all-target-libstdc++-v3
-all-target-libgo: maybe-all-target-libbacktrace
-all-target-libgo: maybe-all-target-libatomic
 configure-target-libgm2: maybe-all-target-libstdc++-v3
 all-target-libgm2: maybe-all-target-libatomic
 configure-target-liboffloadmic: maybe-configure-target-libgomp