From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 06FDC3858418 for ; Wed, 13 Jul 2022 08:23:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 06FDC3858418 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id BE4581FEE8; Wed, 13 Jul 2022 08:23:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1657700626; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uO7BgeDki3wXQKSjitDN2YKOnTE01yS/RZLV5J7+qu4=; b=EHt95aRM29w5/qADSNguLypss6yD32nEyfuzpSGOzTI6cgnItPQtkSSfk0b++4eUTMsRg4 bvPCfKbfuSed2iq+D7z/uvJKEeI81fN0gkbMnj9yXiqBRioHGVpddY6qR2+78uE1kGrpHk xwdO66U2WOq6V3ajWwqgHGQxmncGFl0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1657700626; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uO7BgeDki3wXQKSjitDN2YKOnTE01yS/RZLV5J7+qu4=; b=ZZuNVjc8GQPsZwYRODrIfqxo6hYvmoZWMMRdkYsGzIZR5He20d0ULg21WpOWKGiHOqSFpk mrh1WQRdpoE8UzCw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9492B13754; Wed, 13 Jul 2022 08:23:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id i+L8IhKBzmKWNQAAMHmgww (envelope-from ); Wed, 13 Jul 2022 08:23:46 +0000 Message-ID: Date: Wed, 13 Jul 2022 10:23:46 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Subject: [PATCH] lto-plugin: use -pthread only for detected targets To: gcc-patches@gcc.gnu.org Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2022 08:23:53 -0000 Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin Use -pthread only if we are going to use pthread functionality. PR bootstrap/106156 lto-plugin/ChangeLog: * configure: Regenerate. * configure.ac: Use -pthread only why use_locking == true. * Makefile.in: Rely on ac_lto_plugin_ldflags. --- 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 -- 2.37.0