From patchwork Tue Mar 11 06:42:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 328933 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 15DBD2C00A2 for ; Tue, 11 Mar 2014 17:42:53 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=NbdRtCfdPEOHR1WcBTHR58WJ8UPRsNR49uoPRxrN8EtBhk f8RB023Gw0j230ges764BAxLRF8YmB6j4fP1JKrjj1qwRgweRCn47dTmrfZPyZsm byHJwiq0xiLELKnadCfoHo76BVCd5Kp0dTTDeCVQPUka5+XjJFLeQ3/cX7vL8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=Ngtk+m1/Ad2+m/vkRsOmwMBq/VE=; b=Eu94Ub9FISYum4d57rcT HswxuYj59NCZjydmSKzxYcKjYppHO3LMMj/OgSA7EfPESwv7z/iKBjDVTZUHb9A8 nJV+1xUmmoNA5h9d4hoGr5UlJ2l0x0e+ZABAgnNuJq77Xw5nsYBwSzR4hvQqwMmh sz8UzXuNEj/3O0qZfa6TvRg= Received: (qmail 13255 invoked by alias); 11 Mar 2014 06:42:45 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 13243 invoked by uid 89); 11 Mar 2014 06:42:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: mx02.qsc.de Received: from mx02.qsc.de (HELO mx02.qsc.de) (213.148.130.14) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 11 Mar 2014 06:42:41 +0000 Received: from tux.net-b.de (port-92-194-14-144.dynamic.qsc.de [92.194.14.144]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx02.qsc.de (Postfix) with ESMTPSA id 6331B276EA; Tue, 11 Mar 2014 07:42:37 +0100 (CET) Message-ID: <531EB05C.8060603@net-b.de> Date: Tue, 11 Mar 2014 07:42:36 +0100 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: gcc-patches , Paolo Bonzini , "Iyer, Balaji V" , "Joseph S. Myers" Subject: [Build, Driver] Add -lcilkrts for -fcilkplus When using Cilk Plus (-fcilkplus), it makes sense to automatically link the run-time library (-lcilkrts). This patch mimics libgomp by adding a .spec file; I am not 100% sure whether the .spec file is needed, but the pthread tests in libgomp imply that it makes sense. (libgomp also checks for -lrt for the high-performance timers, a check which is not required for libcilkrts.) Bootstrapped on x86-64-gnu-linux. OK for the trunk? Tobias diff --git a/libcilkrts/Makefile.in b/libcilkrts/Makefile.in index 706a0da..4439292 100644 --- a/libcilkrts/Makefile.in +++ b/libcilkrts/Makefile.in @@ -112,8 +112,8 @@ target_triplet = @target@ DIST_COMMON = $(srcdir)/include/internal/rev.mk README ChangeLog \ $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/configure $(am__configure_deps) \ - $(srcdir)/../mkinstalldirs $(srcdir)/../depcomp \ - $(cilkinclude_HEADERS) + $(srcdir)/../mkinstalldirs $(srcdir)/libcilkrts.spec.in \ + $(srcdir)/../depcomp $(cilkinclude_HEADERS) # If we're building on Linux, use the Linux version script @LINUX_LINKER_SCRIPT_TRUE@am__append_1 = -Wl,--version-script,$(srcdir)/runtime/linux-symbols.ver @@ -134,7 +134,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs -CONFIG_CLEAN_FILES = +CONFIG_CLEAN_FILES = libcilkrts.spec CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ @@ -158,7 +158,8 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(toolexeclibdir)" \ - "$(DESTDIR)$(cilkincludedir)" "$(DESTDIR)$(cilkincludedir)" + "$(DESTDIR)$(cilkincludedir)" "$(DESTDIR)$(cilkincludedir)" \ + "$(DESTDIR)$(toolexeclibdir)" LTLIBRARIES = $(toolexeclib_LTLIBRARIES) libcilkrts_la_LIBADD = am_libcilkrts_la_OBJECTS = cilk-abi-vla.lo os-unix-sysdep.lo bug.lo \ @@ -202,7 +203,8 @@ MULTIDIRS = MULTISUBDIR = MULTIDO = true MULTICLEAN = true -HEADERS = $(cilkinclude_HEADERS) $(nodist_cilkinclude_HEADERS) +HEADERS = $(cilkinclude_HEADERS) $(nodist_cilkinclude_HEADERS) \ + $(nodist_toolexeclib_HEADERS) ETAGS = etags CTAGS = ctags ACLOCAL = @ACLOCAL@ @@ -306,6 +308,7 @@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +link_cilkrts = @link_cilkrts@ localedir = @localedir@ localstatedir = @localstatedir@ lt_cv_dlopen_libs = @lt_cv_dlopen_libs@ @@ -356,6 +359,7 @@ cilkincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include/cilk # Target list. toolexeclib_LTLIBRARIES = libcilkrts.la +nodist_toolexeclib_HEADERS = libcilkrts.spec nodist_cilkinclude_HEADERS = include/cilk/cilk.h libcilkrts_la_SOURCES = \ runtime/config/$(config_dir)/cilk-abi-vla.c \ @@ -501,6 +505,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): +libcilkrts.spec: $(top_builddir)/config.status $(srcdir)/libcilkrts.spec.in + cd $(top_builddir) && $(SHELL) ./config.status $@ install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(toolexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" @@ -889,6 +895,26 @@ uninstall-nodist_cilkincludeHEADERS: test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(cilkincludedir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(cilkincludedir)" && rm -f $$files +install-nodist_toolexeclibHEADERS: $(nodist_toolexeclib_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(toolexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" + @list='$(nodist_toolexeclib_HEADERS)'; test -n "$(toolexeclibdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(toolexeclibdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(toolexeclibdir)" || exit $$?; \ + done + +uninstall-nodist_toolexeclibHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(nodist_toolexeclib_HEADERS)'; test -n "$(toolexeclibdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(toolexeclibdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(toolexeclibdir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -945,7 +971,7 @@ check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) all-multi $(HEADERS) installdirs: - for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(cilkincludedir)" "$(DESTDIR)$(cilkincludedir)"; do \ + for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(cilkincludedir)" "$(DESTDIR)$(cilkincludedir)" "$(DESTDIR)$(toolexeclibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -1004,7 +1030,8 @@ install-dvi: install-dvi-am install-dvi-am: -install-exec-am: install-multi install-toolexeclibLTLIBRARIES +install-exec-am: install-multi install-nodist_toolexeclibHEADERS \ + install-toolexeclibLTLIBRARIES install-html: install-html-am @@ -1048,6 +1075,7 @@ ps-am: uninstall-am: uninstall-cilkincludeHEADERS \ uninstall-nodist_cilkincludeHEADERS \ + uninstall-nodist_toolexeclibHEADERS \ uninstall-toolexeclibLTLIBRARIES .MAKE: all-multi clean-multi distclean-multi install-am install-multi \ @@ -1062,7 +1090,8 @@ uninstall-am: uninstall-cilkincludeHEADERS \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-multi \ - install-nodist_cilkincludeHEADERS install-pdf install-pdf-am \ + install-nodist_cilkincludeHEADERS \ + install-nodist_toolexeclibHEADERS install-pdf install-pdf-am \ install-ps install-ps-am install-strip \ install-toolexeclibLTLIBRARIES installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ @@ -1071,6 +1100,7 @@ uninstall-am: uninstall-cilkincludeHEADERS \ pdf-am ps ps-am tags uninstall uninstall-am \ uninstall-cilkincludeHEADERS \ uninstall-nodist_cilkincludeHEADERS \ + uninstall-nodist_toolexeclibHEADERS \ uninstall-toolexeclibLTLIBRARIES diff --git a/libcilkrts/configure b/libcilkrts/configure index 63181d7..cf7649c 100644 --- a/libcilkrts/configure +++ b/libcilkrts/configure @@ -604,6 +604,7 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +link_cilkrts lt_cv_dlopen_libs toolexeclibdir toolexecdir @@ -4214,7 +4215,7 @@ fi # AC_PROG_LIBTOOL # AC_CONFIG_MACRO_DIR([..]) -ac_config_files="$ac_config_files Makefile" +ac_config_files="$ac_config_files Makefile libcilkrts.spec" # Default to --enable-multilib # Check whether --enable-multilib was given. @@ -11056,7 +11057,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11059 "configure" +#line 11060 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11162,7 +11163,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11165 "configure" +#line 11166 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -14451,6 +14452,60 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext +# Check to see if -pthread or -lpthread is needed. Prefer the former. +# In case the pthread.h system header is not found, this test will fail. +XPCFLAGS="" +CFLAGS="$CFLAGS -pthread" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + void *g(void *d) { return NULL; } +int +main () +{ +pthread_t t; pthread_create(&t,NULL,g,NULL); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + XPCFLAGS=" -Wc,-pthread" +else + CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + void *g(void *d) { return NULL; } +int +main () +{ +pthread_t t; pthread_create(&t,NULL,g,NULL); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +else + as_fn_error "Pthreads are required to build libcilkrts" "$LINENO" 5 +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +# Set up the set of libraries that we need to link against for libcilkrts. +# Note that the CILK_SELF_SPEC in gcc.c may force -pthread, +# which will force linkage against -lpthread (or equivalent for the system). +# That's not 100% ideal, but about the best we can do easily. +if test $enable_shared = yes; then + link_cilkrts="-lcilkrts %{static: $LIBS}" +else + link_cilkrts="-lcilkrts $LIBS" +fi + + # Must be last cat >confcache <<\_ACEOF @@ -15567,6 +15622,7 @@ do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "libcilkrts.spec") CONFIG_FILES="$CONFIG_FILES libcilkrts.spec" ;; "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;