From 4c46b5f0c213c750a752468338af54d249e1da03 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 14 Nov 2014 18:02:50 +0000 Subject: [PATCH] runtime: set library name based on compiler name Different compilers may have different release cadences or ABI incompatibilities, so it does not make sense to use the same library name for runtime libraries intended for different compilers. This CL causes a libgo built by llgo to receive the name libgo-llgo. Likewise, libgobegin is named libgobegin-llgo. From-SVN: r217583 --- libgo/Makefile.am | 30 ++++++++++++--- libgo/Makefile.in | 91 +++++++++++++++++++++++++++------------------- libgo/configure | 31 +++++++++++++++- libgo/configure.ac | 8 ++++ 4 files changed, 116 insertions(+), 44 deletions(-) diff --git a/libgo/Makefile.am b/libgo/Makefile.am index 79cfdd85fb3..c6ee01ba3d3 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -99,8 +99,13 @@ AM_MAKEFLAGS = \ # Subdir rules rely on $(FLAGS_TO_PASS) FLAGS_TO_PASS = $(AM_MAKEFLAGS) +if GOC_IS_LLGO +toolexeclib_LTLIBRARIES = libgo-llgo.la +toolexeclib_LIBRARIES = libgobegin-llgo.a +else toolexeclib_LTLIBRARIES = libgo.la toolexeclib_LIBRARIES = libgobegin.a +endif toolexeclibgo_DATA = \ bufio.gox \ @@ -1993,18 +1998,27 @@ libgo_go_objs = \ unicode/utf16.lo \ unicode/utf8.lo -libgo_la_SOURCES = $(runtime_files) - -libgo_la_LDFLAGS = \ +libgo_ldflags = \ -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS) -libgo_la_LIBADD = \ +libgo_libadd = \ $(libgo_go_objs) ../libbacktrace/libbacktrace.la \ $(LIBATOMIC) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS) +libgo_la_SOURCES = $(runtime_files) +libgo_la_LDFLAGS = $(libgo_ldflags) +libgo_la_LIBADD = $(libgo_libadd) + +libgo_llgo_la_SOURCES = $(runtime_files) +libgo_llgo_la_LDFLAGS = $(libgo_ldflags) +libgo_llgo_la_LIBADD = $(libgo_libadd) + libgobegin_a_SOURCES = \ runtime/go-main.c +libgobegin_llgo_a_SOURCES = \ + runtime/go-main.c + LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) GOCFLAGS = $(CFLAGS) @@ -2066,7 +2080,7 @@ CHECK = \ fi # Build all packages before checking any. -CHECK_DEPS = libgo.la libgobegin.a \ +CHECK_DEPS = \ $(toolexeclibgo_DATA) \ $(toolexeclibgoarchive_DATA) \ $(toolexeclibgocompress_DATA) \ @@ -2095,6 +2109,12 @@ CHECK_DEPS = libgo.la libgobegin.a \ $(toolexeclibgotexttemplate_DATA) \ $(toolexeclibgounicode_DATA) +if GOC_IS_LLGO +CHECK_DEPS += libgo-llgo.la libgobegin-llgo.a +else +CHECK_DEPS += libgo.la libgobegin.a +endif + @go_include@ bufio.lo.dep bufio.lo.dep: $(go_bufio_files) $(BUILDDEPS) diff --git a/libgo/Makefile.in b/libgo/Makefile.in index f5b5e70c007..f42c8f96fbd 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -45,6 +45,8 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ +@GOC_IS_LLGO_TRUE@am__append_1 = libgo-llgo.la libgobegin-llgo.a +@GOC_IS_LLGO_FALSE@am__append_2 = libgo.la libgobegin.a subdir = . DIST_COMMON = README $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/configure $(am__configure_deps) \ @@ -126,6 +128,10 @@ am__installdirs = "$(DESTDIR)$(toolexeclibdir)" \ "$(DESTDIR)$(toolexeclibgounicodedir)" LIBRARIES = $(toolexeclib_LIBRARIES) ARFLAGS = cru +libgobegin_llgo_a_AR = $(AR) $(ARFLAGS) +libgobegin_llgo_a_LIBADD = +am_libgobegin_llgo_a_OBJECTS = go-main.$(OBJEXT) +libgobegin_llgo_a_OBJECTS = $(am_libgobegin_llgo_a_OBJECTS) libgobegin_a_AR = $(AR) $(ARFLAGS) libgobegin_a_LIBADD = am_libgobegin_a_OBJECTS = go-main.$(OBJEXT) @@ -171,10 +177,11 @@ am__DEPENDENCIES_2 = bufio.lo bytes.lo bytes/index.lo crypto.lo \ text/tabwriter.lo text/template.lo text/template/parse.lo \ testing/iotest.lo testing/quick.lo unicode/utf16.lo \ unicode/utf8.lo -libgo_la_DEPENDENCIES = $(am__DEPENDENCIES_2) \ +am__DEPENDENCIES_3 = $(am__DEPENDENCIES_2) \ ../libbacktrace/libbacktrace.la $(am__DEPENDENCIES_1) \ $(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 @@ -220,11 +227,19 @@ am__objects_6 = go-append.lo go-assert.lo go-assert-interface.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) +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) 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) \ $(LDFLAGS) -o $@ +@GOC_IS_LLGO_FALSE@am_libgo_la_rpath = -rpath $(toolexeclibdir) DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/../depcomp am__depfiles_maybe = depfiles @@ -238,7 +253,8 @@ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ -SOURCES = $(libgobegin_a_SOURCES) $(libgo_la_SOURCES) +SOURCES = $(libgobegin_llgo_a_SOURCES) $(libgobegin_a_SOURCES) \ + $(libgo_llgo_la_SOURCES) $(libgo_la_SOURCES) MULTISRCTOP = MULTIBUILDTOP = MULTIDIRS = @@ -501,8 +517,10 @@ AM_MAKEFLAGS = \ # Subdir rules rely on $(FLAGS_TO_PASS) FLAGS_TO_PASS = $(AM_MAKEFLAGS) -toolexeclib_LTLIBRARIES = libgo.la -toolexeclib_LIBRARIES = libgobegin.a +@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_TRUE@toolexeclib_LIBRARIES = libgobegin-llgo.a toolexeclibgo_DATA = \ bufio.gox \ bytes.gox \ @@ -2054,17 +2072,25 @@ libgo_go_objs = \ unicode/utf16.lo \ unicode/utf8.lo -libgo_la_SOURCES = $(runtime_files) -libgo_la_LDFLAGS = \ +libgo_ldflags = \ -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS) -libgo_la_LIBADD = \ +libgo_libadd = \ $(libgo_go_objs) ../libbacktrace/libbacktrace.la \ $(LIBATOMIC) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS) +libgo_la_SOURCES = $(runtime_files) +libgo_la_LDFLAGS = $(libgo_ldflags) +libgo_la_LIBADD = $(libgo_libadd) +libgo_llgo_la_SOURCES = $(runtime_files) +libgo_llgo_la_LDFLAGS = $(libgo_ldflags) +libgo_llgo_la_LIBADD = $(libgo_libadd) libgobegin_a_SOURCES = \ runtime/go-main.c +libgobegin_llgo_a_SOURCES = \ + runtime/go-main.c + LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) AM_GOCFLAGS = $(STRINGOPS_FLAG) GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS) @@ -2126,35 +2152,20 @@ CHECK = \ # Build all packages before checking any. -CHECK_DEPS = libgo.la libgobegin.a \ - $(toolexeclibgo_DATA) \ - $(toolexeclibgoarchive_DATA) \ - $(toolexeclibgocompress_DATA) \ - $(toolexeclibgocontainer_DATA) \ - $(toolexeclibgocrypto_DATA) \ - $(toolexeclibgodebug_DATA) \ - $(toolexeclibgoencoding_DATA) \ - $(toolexeclibgoexp_DATA) \ - $(toolexeclibgogo_DATA) \ - $(toolexeclibgohash_DATA) \ - $(toolexeclibgoimage_DATA) \ - $(toolexeclibgoindex_DATA) \ - $(toolexeclibgoio_DATA) \ - $(toolexeclibgolog_DATA) \ - $(toolexeclibgomath_DATA) \ - $(toolexeclibgomime_DATA) \ - $(toolexeclibgonet_DATA) \ - $(toolexeclibgonethttp_DATA) \ - $(toolexeclibgoos_DATA) \ - $(toolexeclibgopath_DATA) \ - $(toolexeclibgorpc_DATA) \ - $(toolexeclibgoruntime_DATA) \ - $(toolexeclibgosync_DATA) \ - $(toolexeclibgotesting_DATA) \ - $(toolexeclibgotext_DATA) \ - $(toolexeclibgotexttemplate_DATA) \ - $(toolexeclibgounicode_DATA) - +CHECK_DEPS = $(toolexeclibgo_DATA) $(toolexeclibgoarchive_DATA) \ + $(toolexeclibgocompress_DATA) $(toolexeclibgocontainer_DATA) \ + $(toolexeclibgocrypto_DATA) $(toolexeclibgodebug_DATA) \ + $(toolexeclibgoencoding_DATA) $(toolexeclibgoexp_DATA) \ + $(toolexeclibgogo_DATA) $(toolexeclibgohash_DATA) \ + $(toolexeclibgoimage_DATA) $(toolexeclibgoindex_DATA) \ + $(toolexeclibgoio_DATA) $(toolexeclibgolog_DATA) \ + $(toolexeclibgomath_DATA) $(toolexeclibgomime_DATA) \ + $(toolexeclibgonet_DATA) $(toolexeclibgonethttp_DATA) \ + $(toolexeclibgoos_DATA) $(toolexeclibgopath_DATA) \ + $(toolexeclibgorpc_DATA) $(toolexeclibgoruntime_DATA) \ + $(toolexeclibgosync_DATA) $(toolexeclibgotesting_DATA) \ + $(toolexeclibgotext_DATA) $(toolexeclibgotexttemplate_DATA) \ + $(toolexeclibgounicode_DATA) $(am__append_1) $(am__append_2) # At least for now, we need -static-libgo for this test, because # otherwise we can't get the line numbers. runtime_pprof_check_GOCFLAGS = -static-libgo @@ -2380,6 +2391,10 @@ uninstall-toolexeclibLIBRARIES: clean-toolexeclibLIBRARIES: -test -z "$(toolexeclib_LIBRARIES)" || rm -f $(toolexeclib_LIBRARIES) +libgobegin-llgo.a: $(libgobegin_llgo_a_OBJECTS) $(libgobegin_llgo_a_DEPENDENCIES) + -rm -f libgobegin-llgo.a + $(libgobegin_llgo_a_AR) libgobegin-llgo.a $(libgobegin_llgo_a_OBJECTS) $(libgobegin_llgo_a_LIBADD) + $(RANLIB) libgobegin-llgo.a libgobegin.a: $(libgobegin_a_OBJECTS) $(libgobegin_a_DEPENDENCIES) -rm -f libgobegin.a $(libgobegin_a_AR) libgobegin.a $(libgobegin_a_OBJECTS) $(libgobegin_a_LIBADD) @@ -2415,8 +2430,10 @@ clean-toolexeclibLTLIBRARIES: echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done +libgo-llgo.la: $(libgo_llgo_la_OBJECTS) $(libgo_llgo_la_DEPENDENCIES) + $(libgo_llgo_la_LINK) $(am_libgo_llgo_la_rpath) $(libgo_llgo_la_OBJECTS) $(libgo_llgo_la_LIBADD) $(LIBS) libgo.la: $(libgo_la_OBJECTS) $(libgo_la_DEPENDENCIES) - $(libgo_la_LINK) -rpath $(toolexeclibdir) $(libgo_la_OBJECTS) $(libgo_la_LIBADD) $(LIBS) + $(libgo_la_LINK) $(am_libgo_la_rpath) $(libgo_la_OBJECTS) $(libgo_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) diff --git a/libgo/configure b/libgo/configure index 7813c028c47..3352c0ff6d1 100755 --- a/libgo/configure +++ b/libgo/configure @@ -616,6 +616,8 @@ PTHREAD_LIBS PTHREAD_CFLAGS NET_LIBS MATH_LIBS +GOC_IS_LLGO_FALSE +GOC_IS_LLGO_TRUE USING_SPLIT_STACK_FALSE USING_SPLIT_STACK_TRUE SPLIT_STACK @@ -11117,7 +11119,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11120 "configure" +#line 11122 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11223,7 +11225,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11226 "configure" +#line 11228 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -14014,6 +14016,27 @@ $as_echo "#define LINKER_SUPPORTS_SPLIT_STACK 1" >>confdefs.h fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler is llgo" >&5 +$as_echo_n "checking whether compiler is llgo... " >&6; } +if test "${libgo_cv_c_goc_is_llgo+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + libgo_cv_c_goc_is_llgo=no +if $GOC -dumpversion 2>/dev/null | grep llgo >/dev/null 2>&1; then + libgo_cv_c_goc_is_llgo=yes +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_c_goc_is_llgo" >&5 +$as_echo "$libgo_cv_c_goc_is_llgo" >&6; } + if test "$libgo_cv_c_goc_is_llgo" = yes; then + GOC_IS_LLGO_TRUE= + GOC_IS_LLGO_FALSE='#' +else + GOC_IS_LLGO_TRUE='#' + GOC_IS_LLGO_FALSE= +fi + + MATH_LIBS= { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqrt in -lm" >&5 $as_echo_n "checking for sqrt in -lm... " >&6; } @@ -15692,6 +15715,10 @@ if test -z "${USING_SPLIT_STACK_TRUE}" && test -z "${USING_SPLIT_STACK_FALSE}"; as_fn_error "conditional \"USING_SPLIT_STACK\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${GOC_IS_LLGO_TRUE}" && test -z "${GOC_IS_LLGO_FALSE}"; then + as_fn_error "conditional \"GOC_IS_LLGO\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${HAVE_SYS_MMAN_H_TRUE}" && test -z "${HAVE_SYS_MMAN_H_FALSE}"; then as_fn_error "conditional \"HAVE_SYS_MMAN_H\" was never defined. diff --git a/libgo/configure.ac b/libgo/configure.ac index d651827fee5..6dac4d693fe 100644 --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -392,6 +392,14 @@ if test "$libgo_cv_c_linker_supports_split_stack" = yes; then [Define if the linker support split stack adjustments]) fi +AC_CACHE_CHECK([whether compiler is llgo], +[libgo_cv_c_goc_is_llgo], +[libgo_cv_c_goc_is_llgo=no +if $GOC -dumpversion 2>/dev/null | grep llgo >/dev/null 2>&1; then + libgo_cv_c_goc_is_llgo=yes +fi]) +AM_CONDITIONAL(GOC_IS_LLGO, test "$libgo_cv_c_goc_is_llgo" = yes) + dnl Test for the -lm library. MATH_LIBS= AC_CHECK_LIB([m], [sqrt], MATH_LIBS=-lm) -- 2.30.2