From 4bcd34f6ad4242c4f61fa5fd19e19527ab3d3fa6 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 7 Apr 2015 18:09:28 +0000 Subject: [PATCH] re PR go/63731 (Fallback to netgo does not work) PR go/63731 libgo: Build and install libnetgo.a libnetgo.a provides the net package built with the netgo tag enabled. This provides the netgo fallback solution for gccgo. This lib must be explicitly linked in using the -gccgoflags, so is not included by default. From-SVN: r221906 --- libgo/Makefile.am | 30 +++++++++++++--- libgo/Makefile.in | 90 +++++++++++++++++++++++++++++++++-------------- 2 files changed, 89 insertions(+), 31 deletions(-) diff --git a/libgo/Makefile.am b/libgo/Makefile.am index e90d6898259..00fbaabae39 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -105,7 +105,7 @@ toolexeclib_LTLIBRARIES = libgo-llgo.la 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 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_files = \ 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_a_SOURCES = \ 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 @@ BUILDPACKAGE = \ 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 @@ net/check: $(CHECK_DEPS) @$(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) diff --git a/libgo/Makefile.in b/libgo/Makefile.in index b2050084feb..8ecc339012b 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -136,6 +136,15 @@ libgobegin_a_AR = $(AR) $(ARFLAGS) libgobegin_a_LIBADD = am_libgobegin_a_OBJECTS = go-main.$(OBJEXT) libgobegin_a_OBJECTS = $(am_libgobegin_a_OBJECTS) +libnetgo_a_AR = $(AR) $(ARFLAGS) +libnetgo_a_DEPENDENCIES = netgo.o +am__objects_1 = +am__objects_2 = $(am__objects_1) $(am__objects_1) $(am__objects_1) \ + $(am__objects_1) $(am__objects_1) $(am__objects_1) \ + $(am__objects_1) +am__objects_3 = $(am__objects_2) +am_libnetgo_a_OBJECTS = $(am__objects_3) +libnetgo_a_OBJECTS = $(am_libnetgo_a_OBJECTS) LTLIBRARIES = $(toolexeclib_LTLIBRARIES) am__DEPENDENCIES_1 = am__DEPENDENCIES_2 = bufio.lo bytes.lo bytes/index.lo crypto.lo \ @@ -183,23 +192,23 @@ am__DEPENDENCIES_3 = $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) libgo_llgo_la_DEPENDENCIES = $(am__DEPENDENCIES_3) -@LIBGO_IS_LINUX_FALSE@am__objects_1 = lock_sema.lo thread-sema.lo -@LIBGO_IS_LINUX_TRUE@am__objects_1 = lock_futex.lo thread-linux.lo -@HAVE_SYS_MMAN_H_FALSE@am__objects_2 = mem_posix_memalign.lo -@HAVE_SYS_MMAN_H_TRUE@am__objects_2 = mem.lo -@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@am__objects_3 = netpoll_kqueue.lo -@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@am__objects_3 = netpoll_select.lo -@LIBGO_IS_LINUX_TRUE@am__objects_3 = netpoll_epoll.lo -@LIBGO_IS_RTEMS_TRUE@am__objects_4 = rtems-task-variable-add.lo -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@am__objects_5 = getncpu-none.lo -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_TRUE@@LIBGO_IS_SOLARIS_FALSE@am__objects_5 = getncpu-bsd.lo -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@am__objects_5 = getncpu-bsd.lo -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@am__objects_5 = getncpu-solaris.lo -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_IRIX_TRUE@@LIBGO_IS_LINUX_FALSE@am__objects_5 = getncpu-irix.lo -@LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_LINUX_FALSE@am__objects_5 = \ +@LIBGO_IS_LINUX_FALSE@am__objects_4 = lock_sema.lo thread-sema.lo +@LIBGO_IS_LINUX_TRUE@am__objects_4 = lock_futex.lo thread-linux.lo +@HAVE_SYS_MMAN_H_FALSE@am__objects_5 = mem_posix_memalign.lo +@HAVE_SYS_MMAN_H_TRUE@am__objects_5 = mem.lo +@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@am__objects_6 = netpoll_kqueue.lo +@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@am__objects_6 = netpoll_select.lo +@LIBGO_IS_LINUX_TRUE@am__objects_6 = netpoll_epoll.lo +@LIBGO_IS_RTEMS_TRUE@am__objects_7 = rtems-task-variable-add.lo +@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@am__objects_8 = getncpu-none.lo +@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_TRUE@@LIBGO_IS_SOLARIS_FALSE@am__objects_8 = getncpu-bsd.lo +@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@am__objects_8 = getncpu-bsd.lo +@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@am__objects_8 = getncpu-solaris.lo +@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_IRIX_TRUE@@LIBGO_IS_LINUX_FALSE@am__objects_8 = getncpu-irix.lo +@LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_LINUX_FALSE@am__objects_8 = \ @LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_LINUX_FALSE@ getncpu-bsd.lo -@LIBGO_IS_LINUX_TRUE@am__objects_5 = getncpu-linux.lo -am__objects_6 = go-append.lo go-assert.lo go-assert-interface.lo \ +@LIBGO_IS_LINUX_TRUE@am__objects_8 = getncpu-linux.lo +am__objects_9 = go-append.lo go-assert.lo go-assert-interface.lo \ go-byte-array-to-string.lo go-breakpoint.lo go-caller.lo \ go-callers.lo go-can-convert-interface.lo go-cdiv.lo go-cgo.lo \ go-check-interface.lo go-construct-map.lo \ @@ -221,21 +230,21 @@ am__objects_6 = go-append.lo go-assert.lo go-assert-interface.lo \ go-type-string.lo go-typedesc-equal.lo go-unsafe-new.lo \ go-unsafe-newarray.lo go-unsafe-pointer.lo go-unsetenv.lo \ go-unwind.lo go-varargs.lo env_posix.lo heapdump.lo \ - $(am__objects_1) mcache.lo mcentral.lo $(am__objects_2) \ - mfixalloc.lo mgc0.lo mheap.lo msize.lo $(am__objects_3) \ + $(am__objects_4) mcache.lo mcentral.lo $(am__objects_5) \ + mfixalloc.lo mgc0.lo mheap.lo msize.lo $(am__objects_6) \ panic.lo parfor.lo print.lo proc.lo runtime.lo signal_unix.lo \ - thread.lo yield.lo $(am__objects_4) chan.lo cpuprof.lo \ + thread.lo yield.lo $(am__objects_7) chan.lo cpuprof.lo \ go-iface.lo lfstack.lo malloc.lo map.lo mprof.lo netpoll.lo \ rdebug.lo reflect.lo runtime1.lo sema.lo sigqueue.lo string.lo \ - time.lo $(am__objects_5) -am_libgo_llgo_la_OBJECTS = $(am__objects_6) + time.lo $(am__objects_8) +am_libgo_llgo_la_OBJECTS = $(am__objects_9) libgo_llgo_la_OBJECTS = $(am_libgo_llgo_la_OBJECTS) libgo_llgo_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libgo_llgo_la_LDFLAGS) $(LDFLAGS) -o $@ @GOC_IS_LLGO_TRUE@am_libgo_llgo_la_rpath = -rpath $(toolexeclibdir) libgo_la_DEPENDENCIES = $(am__DEPENDENCIES_3) -am_libgo_la_OBJECTS = $(am__objects_6) +am_libgo_la_OBJECTS = $(am__objects_9) libgo_la_OBJECTS = $(am_libgo_la_OBJECTS) libgo_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(libgo_la_LDFLAGS) \ @@ -255,7 +264,8 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libgobegin_llgo_a_SOURCES) $(libgobegin_a_SOURCES) \ - $(libgo_llgo_la_SOURCES) $(libgo_la_SOURCES) + $(libnetgo_a_SOURCES) $(libgo_llgo_la_SOURCES) \ + $(libgo_la_SOURCES) MULTISRCTOP = MULTIBUILDTOP = MULTIDIRS = @@ -522,7 +532,7 @@ AM_MAKEFLAGS = \ FLAGS_TO_PASS = $(AM_MAKEFLAGS) @GOC_IS_LLGO_FALSE@toolexeclib_LTLIBRARIES = libgo.la @GOC_IS_LLGO_TRUE@toolexeclib_LTLIBRARIES = libgo-llgo.la -@GOC_IS_LLGO_FALSE@toolexeclib_LIBRARIES = libgobegin.a +@GOC_IS_LLGO_FALSE@toolexeclib_LIBRARIES = libgobegin.a libnetgo.a @GOC_IS_LLGO_TRUE@toolexeclib_LIBRARIES = libgobegin-llgo.a toolexeclibgo_DATA = \ bufio.gox \ @@ -1025,9 +1035,7 @@ go_mime_files = \ @LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_OPENBSD_FALSE@@LIBGO_IS_SOLARIS_TRUE@go_net_tcpsockopt_file = go/net/tcpsockopt_solaris.go @LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_OPENBSD_FALSE@go_net_tcpsockopt_file = go/net/tcpsockopt_darwin.go @LIBGO_IS_OPENBSD_TRUE@go_net_tcpsockopt_file = go/net/tcpsockopt_openbsd.go -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 \ @@ -1071,6 +1079,15 @@ go_net_files = \ 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) + @LIBGO_IS_386_FALSE@@LIBGO_IS_SOLARIS_TRUE@@LIBGO_IS_SPARC_FALSE@go_os_dir_file = go/os/dir_regfile.go @LIBGO_IS_386_FALSE@@LIBGO_IS_SOLARIS_TRUE@@LIBGO_IS_SPARC_TRUE@go_os_dir_file = go/os/dir_largefile.go @LIBGO_IS_386_TRUE@@LIBGO_IS_SOLARIS_TRUE@go_os_dir_file = go/os/dir_largefile.go @@ -2081,6 +2098,8 @@ libgobegin_a_SOURCES = \ 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)) AM_GOCFLAGS = $(STRINGOPS_FLAG) GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS) @@ -2104,6 +2123,13 @@ BUILDPACKAGE = \ 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 = @@ -2391,6 +2417,10 @@ libgobegin.a: $(libgobegin_a_OBJECTS) $(libgobegin_a_DEPENDENCIES) -rm -f libgobegin.a $(libgobegin_a_AR) libgobegin.a $(libgobegin_a_OBJECTS) $(libgobegin_a_LIBADD) $(RANLIB) libgobegin.a +libnetgo.a: $(libnetgo_a_OBJECTS) $(libnetgo_a_DEPENDENCIES) + -rm -f libnetgo.a + $(libnetgo_a_AR) libnetgo.a $(libnetgo_a_OBJECTS) $(libnetgo_a_LIBADD) + $(RANLIB) libnetgo.a install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(toolexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" @@ -4615,6 +4645,12 @@ net/check: $(CHECK_DEPS) @$(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) -- 2.30.2