From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id E31FC3857B95; Wed, 13 Jul 2022 07:40:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E31FC3857B95 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Martin Liska To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/marxin/heads/PR106156-fix-riscv64-lto-plugin-v2)] lto-plugin: use -pthread only for detected targets X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/users/marxin/heads/PR106156-fix-riscv64-lto-plugin-v2 X-Git-Oldrev: 43997608a0887341160d50f83ad2d0159b387aae X-Git-Newrev: d3a5ce1c0ead2bc64e8428ac3fc7b4c1ee69e8aa Message-Id: <20220713074038.E31FC3857B95@sourceware.org> Date: Wed, 13 Jul 2022 07:40:38 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2022 07:40:39 -0000 https://gcc.gnu.org/g:d3a5ce1c0ead2bc64e8428ac3fc7b4c1ee69e8aa commit d3a5ce1c0ead2bc64e8428ac3fc7b4c1ee69e8aa Author: Martin Liska Date: Wed Jul 13 09:39:34 2022 +0200 lto-plugin: use -pthread only for detected targets Use -pthread only if we are going to use pthread functionality. lto-plugin/ChangeLog: * configure: Regenerate. * configure.ac: Use -pthread only why use_locking == true. * Makefile.in: Rely on ac_lto_plugin_ldflags. Diff: --- lto-plugin/Makefile.in | 2 +- lto-plugin/configure | 6 ++++-- lto-plugin/configure.ac | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lto-plugin/Makefile.in b/lto-plugin/Makefile.in index 9453bc7d607..6b161c01683 100644 --- a/lto-plugin/Makefile.in +++ b/lto-plugin/Makefile.in @@ -345,7 +345,7 @@ libexecsubdir := $(libexecdir)/gcc/$(real_target_noncanonical)/$(gcc_version)$(a AM_CPPFLAGS = -I$(top_srcdir)/../include $(DEFS) AM_CFLAGS = @ac_lto_plugin_warn_cflags@ $(CET_HOST_FLAGS) -DBASE_VERSION='"$(gcc_version)"' # The plug-in depends on pthreads. -AM_LDFLAGS = -pthread @ac_lto_plugin_ldflags@ +AM_LDFLAGS = @ac_lto_plugin_ldflags@ AM_LIBTOOLFLAGS = --tag=disable-static libexecsub_LTLIBRARIES = liblto_plugin.la in_gcc_libs = $(foreach lib, $(libexecsub_LTLIBRARIES), $(gcc_build_dir)/$(lib)) diff --git a/lto-plugin/configure b/lto-plugin/configure index 870e49b2e62..0967ba1c798 100755 --- a/lto-plugin/configure +++ b/lto-plugin/configure @@ -6023,6 +6023,8 @@ case $target in esac if test x$use_locking = xyes; then + LDFLAGS="$LDFLAGS -pthread" + ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" if test "x$ac_cv_header_pthread_h" = xyes; then : @@ -12104,7 +12106,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12107 "configure" +#line 12109 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12210,7 +12212,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12213 "configure" +#line 12215 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/lto-plugin/configure.ac b/lto-plugin/configure.ac index 18eb4f60b0a..a350aa56a8b 100644 --- a/lto-plugin/configure.ac +++ b/lto-plugin/configure.ac @@ -100,6 +100,8 @@ case $target in esac if test x$use_locking = xyes; then + LDFLAGS="$LDFLAGS -pthread" + AC_CHECK_HEADER(pthread.h, [AC_DEFINE(HAVE_PTHREAD_LOCKING, 1, [Define if the system provides pthread locking mechanism.])]) fi