This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

libgo patch committed: Link against -lm


This patch links libgo against -lm if appropriate.  This is for PR
46840.  Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

diff -r 47fef7574d60 libgo/Makefile.am
--- a/libgo/Makefile.am	Tue Dec 07 16:13:14 2010 -0800
+++ b/libgo/Makefile.am	Tue Dec 07 18:05:51 2010 -0800
@@ -1267,7 +1267,7 @@
 
 libgo_la_SOURCES = $(runtime_files)
 
-libgo_la_LIBADD = $(libgo_go_objs) $(LIBFFI) $(PTHREAD_LIBS)
+libgo_la_LIBADD = $(libgo_go_objs) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS)
 
 libgobegin_a_SOURCES = \
 	runtime/go-main.c
@@ -1283,7 +1283,7 @@
 
 GOLINK = $(LIBTOOL) --tag GO --mode-link $(GOC) \
 	$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) \
-	$(PTHREAD_LIBS) -o $@
+	$(PTHREAD_LIBS) $(MATH_LIBS) -o $@
 
 # Build a package.
 BUILDARCHIVE = \
diff -r 47fef7574d60 libgo/configure.ac
--- a/libgo/configure.ac	Tue Dec 07 16:13:14 2010 -0800
+++ b/libgo/configure.ac	Tue Dec 07 18:05:51 2010 -0800
@@ -187,6 +187,11 @@
 	    [Define if the linker support split stack adjustments])
 fi
 
+dnl Test for the -lm library.
+MATH_LIBS=
+AC_CHECK_LIB([m], [sqrt], MATH_LIBS=-lm)
+AC_SUBST(MATH_LIBS)
+
 dnl Test whether the compiler supports the -pthread option.
 AC_CACHE_CHECK([whether -pthread is supported],
 [ac_cv_libgo_pthread_supported],

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]