Hi, Attached are patches to enable gccgo to build properly on Debian GNU/Hurd on gcc-6 (6-6.2.1-5).
The first three patches are Debian-specific: * debian_rules.defs.diff: Enables build of gccgo for GNU/Hurd Define patches for the generated series file: * debian_rules.patch.diff: Enables split-stack support. * debian_rules.patch.diff: Does not enable split-stack support. * src_gcc_config_i386_gnu.h.diff: Enable split-stack support The test suite results are as follows: Without split-stack support: === go Summary === # of expected passes 7359 # of unexpected failures 7 # of expected failures 1 # of untested testcases 10 # of unsupported tests 2 === libgo Summary === # of expected passes 121 # of unexpected failures 13 With split-stack support: === go Summary === # of expected passes 7366 # of unexpected failures 8 # of expected failures 1 # of untested testcases 6 # of unsupported tests 2 === libgo Summary === # of expected passes 120 # of unexpected failures 14 All failing go tests and more than half of the libgo tests are runtime errors due to exception handling not working as expected: Aborted runtime_sighandler ... fatal error: unexpected signal during runtime execution panic: runtime error: invalid memory address or nil pointer dereference The above problems are probably due to some remaining issues in gnumach/hurd/glibc to be solved. According to Samuel Thibault these problems can be handled late when the patches are accepted upstream or in Debian gcc. Another more annoying gnumch/hurd/glibc bug is that the built program go (go-6 in Debian) gets killed when executed from the shell vi path, but not when issued directly: /usr/bin/go-6 works fine. go-6 Segmentation fault (core dumped) gdb /usr/bin/go-6 -c ./core warning: Unexpected size of section `.reg2/16883' in core file. Core was generated by `go-6'. Program terminated with signal SIGSEGV, Segmentation fault. warning: Unexpected size of section `.reg2/16883' in core file. #0 0x01e854ae in ?? () (gdb) bt #0 0x01e854ae in ?? () #1 0x00000000 in ?? () Nevertheless, it seems like not so much is left for gccgo working properly on GNU/Hurd. Thanks!
--- a/debian/rules.defs 2014-01-07 11:10:44.000000000 +0100 +++ b/debian/rules.defs 2014-01-07 11:23:47.000000000 +0100 @@ -933,7 +933,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) @@ -943,7 +943,7 @@ ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),$(go_no_cpus))) with_go := disabled for cpu $(DEB_TARGET_ARCH_CPU) endif -ifneq (,$(findstring $(DEB_TARGET_GNU_SYSTEM),$(go_no_systems))) +ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),$(go_no_systems))) with_go := disabled for system $(DEB_TARGET_GNU_SYSTEM) endif ifeq ($(go_no_cross)-$(DEB_CROSS),yes-yes)
--- a/debian/rules.patch.orig 2016-11-12 16:50:46.000000000 +0100 +++ b/debian/rules.patch 2016-11-12 16:55:24.000000000 +0100 @@ -276,6 +276,27 @@ ifeq ($(DEB_TARGET_ARCH_OS),hurd) debian_patches += hurd-changes + debian_patches += \ + src_gcc_config_i386_gnu.h \ + src_libgo_configure.ac \ + src_libgo_go_net_sendfile_gnu.go \ + src_libgo_go_net_sock_gnu.go \ + src_libgo_go_net_sockopt_gnu.go \ + src_libgo_go_net_sockoptip_gnu.go \ + src_libgo_go_syscall_libcall_gnu_386.go \ + src_libgo_go_syscall_libcall_gnu.go \ + src_libgo_go_syscall_libcall_posix-1.go \ + src_libgo_go_syscall_socket_gnu.go \ + src_libgo_go_syscall_wait.c \ + src_libgo_Makefile.am \ + src_libgo_Makefile.in \ + src_libgo_mksysinfo.sh \ + src_libgo_runtime_getncpu-gnu.c \ + src_libgo_runtime_netpoll.goc \ + src_libgo_go_os_os_test.go \ + src_libgo_go_syscall_syscall_gnu_test.go \ + src_libgo_testsuite_gotest \ + add-gnu-to-libgo-headers endif debian_patches += gcc-ice-dump
--- a/debian/rules.patch.orig 2016-11-12 16:50:46.000000000 +0100 +++ b/debian/rules.patch 2016-11-12 16:55:24.000000000 +0100 @@ -276,6 +276,26 @@ ifeq ($(DEB_TARGET_ARCH_OS),hurd) debian_patches += hurd-changes + debian_patches += \ + src_libgo_configure.ac \ + src_libgo_go_net_sendfile_gnu.go \ + src_libgo_go_net_sock_gnu.go \ + src_libgo_go_net_sockopt_gnu.go \ + src_libgo_go_net_sockoptip_gnu.go \ + src_libgo_go_syscall_libcall_gnu_386.go \ + src_libgo_go_syscall_libcall_gnu.go \ + src_libgo_go_syscall_libcall_posix-1.go \ + src_libgo_go_syscall_socket_gnu.go \ + src_libgo_go_syscall_wait.c \ + src_libgo_Makefile.am \ + src_libgo_Makefile.in \ + src_libgo_mksysinfo.sh \ + src_libgo_runtime_getncpu-gnu.c \ + src_libgo_runtime_netpoll.goc \ + src_libgo_go_os_os_test.go \ + src_libgo_go_syscall_syscall_gnu_test.go \ + src_libgo_testsuite_gotest \ + add-gnu-to-libgo-headers endif debian_patches += gcc-ice-dump
Index: gcc-6-6.2.1-4.1/src/gcc/config/i386/gnu.h =================================================================== --- gcc-6-6.2.1-4.1.orig/src/gcc/config/i386/gnu.h +++ gcc-6-6.2.1-4.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