PR 63731 points out that when using gccgo there is no way to request a Go program that uses the native Go DNS lookup code rather than using the system libraries. This patch from Lynn Boger at least provides a mechanism for that, by adding a -lnetgo library that can be used to pick up the Go DNS lookup routines. This isn't complete fix because we still need to document it somewhere. Bootstrapped on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
diff -r 9ea7cea1d658 libgo/Makefile.am --- a/libgo/Makefile.am Mon Apr 06 18:15:34 2015 -0700 +++ b/libgo/Makefile.am Tue Apr 07 11:08:23 2015 -0700 @@ -105,7 +105,7 @@ toolexeclib_LIBRARIES = libgobegin-llgo.a else toolexeclib_LTLIBRARIES = libgo.la -toolexeclib_LIBRARIES = libgobegin.a +toolexeclib_LIBRARIES = libgobegin.a libnetgo.a endif toolexeclibgo_DATA = \ @@ -774,9 +774,7 @@ endif endif -go_net_files = \ - go/net/cgo_unix.go \ - $(go_net_cgo_file) \ +go_net_common_files = \ $(go_net_cloexec_file) \ go/net/dial.go \ go/net/dnsclient.go \ @@ -820,6 +818,15 @@ go/net/unixsock.go \ go/net/unixsock_posix.go +go_net_files = \ + go/net/cgo_unix.go \ + $(go_net_cgo_file) \ + $(go_net_common_files) + +go_netgo_files = \ + go/net/cgo_stub.go \ + $(go_net_common_files) + if LIBGO_IS_SOLARIS if LIBGO_IS_386 go_os_dir_file = go/os/dir_largefile.go @@ -2025,6 +2032,9 @@ libgobegin_llgo_a_SOURCES = \ runtime/go-main.c +libnetgo_a_SOURCES = $(go_netgo_files) +libnetgo_a_LIBADD = netgo.o + LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) GOCFLAGS = $(CFLAGS) @@ -2049,6 +2059,12 @@ files=`echo $^ | sed -e 's/[^ ]*\.gox//g'`; \ $(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//' -e 's/-go$$//'` -o $@ $$files +# Build netgo.o. +BUILDNETGO = \ + $(MKDIR_P) $(@D); \ + files=`echo $^ | sed -e 's/[^ ]*\.gox//g'`; \ + $(GOCOMPILE) -I . -c -fgo-pkgpath=net -o $@ $$files + GOTESTFLAGS = GOBENCH = @@ -2270,6 +2286,12 @@ @$(CHECK) .PHONY: net/check +@go_include@ netgo.o.dep +netgo.o.dep: $(go_netgo_files) + $(BUILDDEPS) +netgo.o: $(go_netgo_files) + $(BUILDNETGO) + @go_include@ os.lo.dep os.lo.dep: $(go_os_files) $(BUILDDEPS)