public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-1696] lto-plugin: use -pthread only for detected targets
@ 2022-07-14 11:27 Martin Liska
  0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2022-07-14 11:27 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:29f40a8047fa9b6ccde2174ca126b78a535e1a61

commit r13-1696-g29f40a8047fa9b6ccde2174ca126b78a535e1a61
Author: Martin Liska <mliska@suse.cz>
Date:   Thu Jul 14 09:51:33 2022 +0200

    lto-plugin: use -pthread only for detected targets
    
    Use -pthread only if we are going to use pthread functionality.
    
            PR bootstrap/106156
    
    lto-plugin/ChangeLog:
    
            * Makefile.am: Use ac_lto_plugin_extra_ldflags for AM_LDFLAGS.
            * configure.ac: Use AC_SUBST(ac_lto_plugin_extra_ldflags).
            * Makefile.in: Regenerate.
            * configure: Regenerate.

Diff:
---
 lto-plugin/Makefile.am  |  3 +--
 lto-plugin/Makefile.in  |  4 ++--
 lto-plugin/configure    | 10 ++++++++--
 lto-plugin/configure.ac |  5 +++++
 4 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/lto-plugin/Makefile.am b/lto-plugin/Makefile.am
index 482946e4dd5..aba3c5a00cd 100644
--- a/lto-plugin/Makefile.am
+++ b/lto-plugin/Makefile.am
@@ -9,8 +9,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@ @ac_lto_plugin_extra_ldflags@
 AM_LIBTOOLFLAGS = --tag=disable-static
 override CFLAGS := $(filter-out -fsanitize=address -fsanitize=hwaddress,$(CFLAGS))
 override LDFLAGS := $(filter-out -fsanitize=address -fsanitize=hwaddress,$(LDFLAGS))
diff --git a/lto-plugin/Makefile.in b/lto-plugin/Makefile.in
index 9453bc7d607..cb568e1e09f 100644
--- a/lto-plugin/Makefile.in
+++ b/lto-plugin/Makefile.in
@@ -276,6 +276,7 @@ abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_lto_plugin_extra_ldflags = @ac_lto_plugin_extra_ldflags@
 ac_lto_plugin_ldflags = @ac_lto_plugin_ldflags@
 ac_lto_plugin_warn_cflags = @ac_lto_plugin_warn_cflags@
 accel_dir_suffix = @accel_dir_suffix@
@@ -344,8 +345,7 @@ gcc_version := $(shell @get_gcc_base_ver@ $(top_srcdir)/../gcc/BASE-VER)
 libexecsubdir := $(libexecdir)/gcc/$(real_target_noncanonical)/$(gcc_version)$(accel_dir_suffix)
 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@ @ac_lto_plugin_extra_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..fdb8a5964b4 100755
--- a/lto-plugin/configure
+++ b/lto-plugin/configure
@@ -650,6 +650,7 @@ LD
 FGREP
 SED
 LIBTOOL
+ac_lto_plugin_extra_ldflags
 LTO_PLUGIN_USE_SYMVER_SUN_FALSE
 LTO_PLUGIN_USE_SYMVER_SUN_TRUE
 LTO_PLUGIN_USE_SYMVER_GNU_FALSE
@@ -6012,6 +6013,7 @@ fi
 
 # Check for thread headers.
 use_locking=no
+ac_lto_plugin_extra_ldflags=
 
 case $target in
   riscv*)
@@ -6031,8 +6033,12 @@ $as_echo "#define HAVE_PTHREAD_LOCKING 1" >>confdefs.h
 fi
 
 
+
+  ac_lto_plugin_extra_ldflags="-pthread"
 fi
 
+
+
 case `pwd` in
   *\ * | *\	*)
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
@@ -12104,7 +12110,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 12113 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12210,7 +12216,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 12219 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/lto-plugin/configure.ac b/lto-plugin/configure.ac
index 18eb4f60b0a..e69a7bd9ec0 100644
--- a/lto-plugin/configure.ac
+++ b/lto-plugin/configure.ac
@@ -89,6 +89,7 @@ AM_CONDITIONAL(LTO_PLUGIN_USE_SYMVER_SUN, [test "x$lto_plugin_use_symver" = xsun
 
 # Check for thread headers.
 use_locking=no
+ac_lto_plugin_extra_ldflags=
 
 case $target in
   riscv*)
@@ -102,8 +103,12 @@ esac
 if test x$use_locking = xyes; then
   AC_CHECK_HEADER(pthread.h,
     [AC_DEFINE(HAVE_PTHREAD_LOCKING, 1, [Define if the system provides pthread locking mechanism.])])
+
+  ac_lto_plugin_extra_ldflags="-pthread"
 fi
 
+AC_SUBST(ac_lto_plugin_extra_ldflags)
+
 AM_PROG_LIBTOOL
 ACX_LT_HOST_FLAGS
 AC_SUBST(target_noncanonical)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-14 11:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-14 11:27 [gcc r13-1696] lto-plugin: use -pthread only for detected targets Martin Liska

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).