This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: libgo patch committed: Update to Go 1.4
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: Ian Lance Taylor <iant at golang dot org>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, "gofrontend-dev\ at googlegroups dot com" <gofrontend-dev at googlegroups dot com>
- Date: Mon, 19 Jan 2015 13:17:09 +0100
- Subject: Re: libgo patch committed: Update to Go 1.4
- Authentication-results: sourceware.org; auth=none
- References: <CAOyqgcW7+8ZXASWH4CLuK3zWEOb8zu8Lx0oeqTzaABOWFQKBxQ at mail dot gmail dot com> <yddwq4oqa5e dot fsf at lokon dot CeBiTec dot Uni-Bielefeld dot DE> <CAOyqgcXD6vkFT1J1nTXVOEDyH=t9vudMBnBPwWvxnmDvd3_6Cg at mail dot gmail dot com>
Ian Lance Taylor <iant@golang.org> writes:
> On Thu, Jan 15, 2015 at 8:30 AM, Rainer Orth
> <ro@cebitec.uni-bielefeld.de> wrote:
>>
>> Apart from that, bootstrap fails in gotools: due to the use of
>> -static-libgo, all commands there fail to link since the socket
>> functions are missing. It seems like $LIBS from libgo needs to be added
>> somewhere, but I'm unsure how best to handle this. To make any progress
>> at all, I've just manually added -lsocket -lnsl to gotools/Makefile
>> (AM_LDFLAGS).
>
> I also don't know what the best way is to handle this. For now I've
> just added a configure test to check whether the libraries are needed.
> Based on the libgo build, as far as I can tell, no other libraries
> should be needed.
While this is true for Solaris 11, Solaris 10 needs librt for nanosleep,
sched_yield and the sem_* functions. The following patch copies the
corresponding libgo test and allows gotools to build even on Solaris 10.
Rainer
diff --git a/gotools/Makefile.am b/gotools/Makefile.am
--- a/gotools/Makefile.am
+++ b/gotools/Makefile.am
@@ -108,11 +108,11 @@ bin_PROGRAMS = go$(EXEEXT) gofmt$(EXEEXT
libexecsub_PROGRAMS = cgo$(EXEEXT)
go$(EXEEXT): $(go_cmd_go_files) zdefaultcc.go $(LIBGODEP)
- $(GOLINK) $(go_cmd_go_files) zdefaultcc.go $(NET_LIBS)
+ $(GOLINK) $(go_cmd_go_files) zdefaultcc.go $(LIBS) $(NET_LIBS)
gofmt$(EXEEXT): $(go_cmd_gofmt_files) $(LIBGODEP)
- $(GOLINK) $(go_cmd_gofmt_files) $(NET_LIBS)
+ $(GOLINK) $(go_cmd_gofmt_files) $(LIBS) $(NET_LIBS)
cgo$(EXEEXT): $(go_cmd_cgo_files) zdefaultcc.go $(LIBGODEP)
- $(GOLINK) $(go_cmd_cgo_files) zdefaultcc.go $(NET_LIBS)
+ $(GOLINK) $(go_cmd_cgo_files) zdefaultcc.go $(LIBS) $(NET_LIBS)
else
diff --git a/gotools/configure.ac b/gotools/configure.ac
--- a/gotools/configure.ac
+++ b/gotools/configure.ac
@@ -79,6 +79,10 @@ AC_CACHE_CHECK([for socket libraries], g
NET_LIBS="$gotools_cv_lib_sockets"
AC_SUBST(NET_LIBS)
+dnl Test if -lrt is required for sched_yield and/or nanosleep.
+AC_SEARCH_LIBS([sched_yield], [rt])
+AC_SEARCH_LIBS([nanosleep], [rt])
+
AC_CONFIG_FILES(Makefile)
AC_OUTPUT
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University