public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* libgo patch committed: Build libnetgo.a
@ 2015-04-07 18:09 Ian Lance Taylor
  2015-04-08 12:41 ` Lynn A. Boger
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Lance Taylor @ 2015-04-07 18:09 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 459 bytes --]

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

[-- Attachment #2: foo.txt --]
[-- Type: text/plain, Size: 1728 bytes --]

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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-08 12:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-07 18:09 libgo patch committed: Build libnetgo.a Ian Lance Taylor
2015-04-08 12:41 ` Lynn A. Boger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).