Hi,
Attached are patches to enable gccgo to build properly on Debian
GNU/Hurd on gcc-8 (8-8-20171108-1).
The first two patches are Debian-specific:
Enable build of gccgo for GNU/Hurd:
* debian_rules.defs.diff
Define patches for the generated series file:
* debian_rules.patch.diff
The third enables split-stack support:
* src_gcc_config_i386_gnu.h.diff
The test suite results are as follows:
=== go Summary ===
# of expected passes 7359
# of unexpected failures 13
# of expected failures 1
# of untested testcases 7
# of unsupported tests 2
=== libgo Summary ===
# of expected passes 128
# of unexpected failures 27
Most failing go tests and more than half of the libgo tests are runtime errors
probably due to exception handling not working as expected, stopping execution
with SIGSEGV. These issues are also present in the gcc-6 port (where libgo is
implemented with more C code) and might be due to issues in gnumach/hurd/glibc
yet to be solved.
Another large group of tests, mainly in libgo, fails with SIGILL. The reason for
these failures are also currently unknown. Maybe it is still some more things to
address with the port, but the cause can also be due to the above. Unfortunately
gdb and rpctrace are not especially usable, the former due to hangs, and the
second due to bugs in multi-thread support.
Another issue is that /proc/self/exe has to return an absolute path for the
built program go-7 to execute properly. This is solved by a pending patch for
glibc in Debian and will be available in the next upload of glibc-2.24.
Adding to this, the executable ./build/gotools/go does work displaying the help
text, but e.g. ./build/gotools/go env exits with a SIGILL: Illegal instruction.
Furthermore, since more code is written in go the previous routine
src/libgo/rutime/netpoll_select.c has to be rewritten in go. The supplied file
src/libgo/go/runtime/netpoll_gnu.go is merely a stub for now and has to be
implemented using either select or poll since neither epoll or kqueue or exists
in GNU/Hurd. I'm currently working on an implementation using poll(2).
Nevertheless, it seems like not so much is left for gccgo working
properly on GNU/Hurd, as for gcc-6. However, since I'm currently stuck, having
spent a lot of time debugging, it is time to hand over to more people taking a
look at this port.
More detailed information on specific issues will be supplied on request.
Thanks!
--- a/debian/rules.defs.orig 2017-08-14 14:40:23.000000000 +0200
+++ b/debian/rules.defs 2017-08-14 15:26:42.000000000 +0200
@@ -807,7 +807,7 @@
ifeq (,$(filter $(distrelease),lenny etch squeeze dapper hardy jaunty karmic lucid maverick natty oneiric))
go_no_cpus := $(filter-out arm, $(go_no_cpus))
endif
-go_no_systems := gnu kfreebsd-gnu
+go_no_systems := kfreebsd
ifneq ($(with_base_only),yes)
ifneq ($(separate_lang),yes)
--- a/debian/rules.patch 2017-09-06 11:49:38.000000000 +0200
+++ b/debian/rules.patch 2017-09-06 12:02:13.000000000 +0200
@@ -228,7 +228,21 @@
endif
ifeq ($(DEB_TARGET_ARCH_OS),hurd)
- debian_patches += hurd-changes
+ debian_patches += hurd-changes \
+ src_gcc_config_i386_gnu.h \
+ src_libgo_build \
+ src_libgo_runtime \
+ src_libgo_go_crypto \
+ src_libgo_go_net \
+ src_libgo_go_os \
+ src_libgo_go_runtime \
+ src_libgo_go_syscall \
+ src_libgo_go_go_build_syslist.go \
+ add-gnu-to-libgo-headers \
+ add-gnu-to-libgo-test-headers \
+ src_libgo_go_syscall_syscall_gnu_test.go \
+ src_libgo_testsuite_gotest \
+
endif
debian_patches += gcc-ice-dump
Index: gcc-8-8-20171108-1.1/src/gcc/config/i386/gnu.h
===================================================================
--- gcc-8-8-20171108-1.1.orig/src/gcc/config/i386/gnu.h
+++ gcc-8-8-20171108-1.1/src/gcc/config/i386/gnu.h
@@ -37,11 +37,14 @@ along with GCC. If not, see <http://www
#ifdef TARGET_LIBC_PROVIDES_SSP
-/* Not supported yet. */
-# undef TARGET_THREAD_SSP_OFFSET
-
-/* Not supported yet. */
-# undef TARGET_CAN_SPLIT_STACK
-# undef TARGET_THREAD_SPLIT_STACK_OFFSET
+/* i386 glibc provides __stack_chk_guard in %gs:0x14. */
+#define TARGET_THREAD_SSP_OFFSET 0x14
+/* We only build the -fsplit-stack support in libgcc if the
+ assembler has full support for the CFI directives. */
+#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
+#define TARGET_CAN_SPLIT_STACK
+#endif
+/* We steal the last transactional memory word. */
+#define TARGET_THREAD_SPLIT_STACK_OFFSET 0x30
#endif