Hi, Attached are patches to enable gccgo to build properly on Debian GNU/Hurd on gcc-4.7 (4.7.3-4).
patch0.diff: debian/rules.defs: go_no_systems: remove gnu, with_go: Check for DEB_TARGET_GNU_OS instead of DEB_TARGET_GNU_SYSTEM since that triggers a disabled build with kfreebsd-gnu. patch1.diff: src/libgo/runtime/proc.c: Workaround: enable code for !SETCONTEXT_CLOBBERS_TLS patch2.diff: src/libgo/configure.ac: add support for gnu, new variable LIBGO_IS_GNU
# Use DEB_TARGET_GNU_OS in findstring since gnu is found kfreebsd-gnu # when DEB_TARGET_GNU_SYSTEM is used! --- a/debian/rules.defs +++ b/debian/rules.defs @@ -705,7 +705,7 @@ ifneq ($(trunk_build),yes) go_no_cpus := $(go_no_cpus) alpha arm64 endif -go_no_systems := gnu kfreebsd-gnu +go_no_systems := kfreebsd-gnu ifneq ($(with_base_only),yes) ifneq ($(separate_lang),yes) @@ -715,8 +715,8 @@ 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))) - with_go := disabled for system $(DEB_TARGET_GNU_SYSTEM) +ifneq (,$(findstring $(DEB_TARGET_GNU_OS),$(go_no_systems))) +with_go := disabled for system $(DEB_TARGET_GNU_SYSTEM) endif ifeq ($(go_no_cross)-$(DEB_CROSS),yes-yes) with_go := disabled for cross compiler package
--- a/src/libgo/runtime/proc.c +++ b/src/libgo/runtime/proc.c @@ -69,7 +69,8 @@ static __thread G *g; static __thread M *m; -#ifndef SETCONTEXT_CLOBBERS_TLS +/* #ifndef SETCONTEXT_CLOBBERS_TLS */ +#if !defined(SETCONTEXT_CLOBBERS_TLS) || defined(__GNU__) static inline void initcontext(void)
--- a/src/libgo/configure.ac +++ b/src/libgo/configure.ac @@ -140,6 +140,7 @@ *-*-netbsd*) is_netbsd=yes; GOOS=netbsd ;; *-*-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) @@ -148,6 +149,7 @@ AM_CONDITIONAL(LIBGO_IS_NETBSD, test $is_netbsd = 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) AC_SUBST(GOOS) dnl N.B. Keep in sync with gcc/testsuite/go.test/go-test.exp (go-set-goarch).