This patch to libgo fixes the build when configuring with --enable-static=no. It also ensures that a couple of .gox files that are only used for testing are built. Since they are only used for testing, nothing depends on them, so adding them to noinst_DATA makes sure they are built for the gotools tests. Bootstrapped and ran Go tests on x86_64-pc-linux-gnu both with and without --enable-static=no. Committed to mainline.
Ian
Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 253025) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -5deeab42b0e5fdf2721773ce7fdaf61716599d4d +1fcb9bb3cefb97cfab1e623826a1cc3f6aadd5f7 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: libgo/Makefile.am =================================================================== --- libgo/Makefile.am (revision 253025) +++ libgo/Makefile.am (working copy) @@ -395,6 +395,13 @@ toolexeclibgounicode_DATA = \ unicode/utf16.gox \ unicode/utf8.gox +# Some packages are only needed for tests, so unlike the other +# internal packages nothing will explicitly depend on them. +# Force them to be built. +noinst_DATA = \ + internal/testenv.gox \ + net/internal/socktest.gox + if LIBGO_IS_RTEMS rtems_task_variable_add_file = runtime/rtems-task-variable-add.c else @@ -573,7 +580,7 @@ s-runtime-inc: runtime.lo Makefile rm -f runtime.inc.tmp2 runtime.inc.tmp3 $(STAMP) $@ -noinst_DATA = zstdpkglist.go zdefaultcc.go +noinst_DATA += zstdpkglist.go zdefaultcc.go # Generate the list of go std packages that were included in libgo zstdpkglist.go: s-zstdpkglist; @true @@ -924,6 +931,12 @@ libgotool_a_SOURCES = libgotool_a_DEPENDENCIES = $(addsuffix .lo,$(GOTOOL_PACKAGES)) libgotool_a_LIBADD = $(addsuffix .o,$(GOTOOL_PACKAGES)) +define STATIC_template +$(subst -,_,$(subst .,_,$(subst /,_,$(1))))_GOCFLAGS = -static +endef + +$(foreach package,$(GOTOOL_PACKAGES),$(eval $(call STATIC_template,$(package).lo))) + # Make sure runtime.inc is built before compiling any .c file. $(libgo_la_OBJECTS): runtime.inc $(libgo_llgo_la_OBJECTS): runtime.inc