* [PATCH] lto-plugin: use -pthread only for detected targets
@ 2022-07-13 8:23 Martin Liška
2022-07-13 12:15 ` Richard Biener
0 siblings, 1 reply; 6+ messages in thread
From: Martin Liška @ 2022-07-13 8:23 UTC (permalink / raw)
To: gcc-patches
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] lto-plugin: use -pthread only for detected targets
2022-07-13 8:23 [PATCH] lto-plugin: use -pthread only for detected targets Martin Liška
@ 2022-07-13 12:15 ` Richard Biener
2022-07-14 10:03 ` Martin Liška
0 siblings, 1 reply; 6+ messages in thread
From: Richard Biener @ 2022-07-13 12:15 UTC (permalink / raw)
To: Martin Liška; +Cc: GCC Patches
On Wed, Jul 13, 2022 at 10:24 AM Martin Liška <mliska@suse.cz> wrote:
>
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>
> Ready to be installed?
Didn't we have it that way and not work? IIRC LDFLAGS is only
used during configure link tests and _not_ substituted?
> 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
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] lto-plugin: use -pthread only for detected targets
2022-07-13 12:15 ` Richard Biener
@ 2022-07-14 10:03 ` Martin Liška
2022-07-14 10:10 ` Richard Biener
0 siblings, 1 reply; 6+ messages in thread
From: Martin Liška @ 2022-07-14 10:03 UTC (permalink / raw)
To: Richard Biener; +Cc: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 382 bytes --]
On 7/13/22 14:15, Richard Biener wrote:
> Didn't we have it that way and not work? IIRC LDFLAGS is only
> used during configure link tests and _not_ substituted?
You are right.
There's a proper fix that utilizes AM_CONDITIONAL and sets LDFLAGS properly
in Makefile.am.
Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
Ready to be installed?
Thanks,
Martin
[-- Attachment #2: 0001-lto-plugin-use-pthread-only-for-detected-targets.patch --]
[-- Type: text/x-patch, Size: 5102 bytes --]
From bf0e9635086b5b3f88a40bab9839b2c438eed831 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Thu, 14 Jul 2022 09:51:33 +0200
Subject: [PATCH] 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: Append -pthread to LDFLAGS if
LTO_PLUGIN_USE_PTHREAD.
* configure.ac: Use AM_CONDITIONAL for LTO_PLUGIN_USE_PTHREAD.
* Makefile.in: Regenerate.
* configure: Regenerate.
---
lto-plugin/Makefile.am | 7 +++++--
lto-plugin/Makefile.in | 5 +++--
lto-plugin/configure | 19 +++++++++++++++++--
lto-plugin/configure.ac | 2 ++
4 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/lto-plugin/Makefile.am b/lto-plugin/Makefile.am
index 482946e4dd5..ce51e8e173e 100644
--- a/lto-plugin/Makefile.am
+++ b/lto-plugin/Makefile.am
@@ -9,12 +9,15 @@ 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
override CFLAGS := $(filter-out -fsanitize=address -fsanitize=hwaddress,$(CFLAGS))
override LDFLAGS := $(filter-out -fsanitize=address -fsanitize=hwaddress,$(LDFLAGS))
+if LTO_PLUGIN_USE_PTHREAD
+override LDFLAGS := $(LDFLAGS) -pthread
+endif
+
libexecsub_LTLIBRARIES = liblto_plugin.la
gcc_build_dir = @gcc_build_dir@
in_gcc_libs = $(foreach lib, $(libexecsub_LTLIBRARIES), $(gcc_build_dir)/$(lib))
diff --git a/lto-plugin/Makefile.in b/lto-plugin/Makefile.in
index 9453bc7d607..c323b6a51de 100644
--- a/lto-plugin/Makefile.in
+++ b/lto-plugin/Makefile.in
@@ -344,8 +344,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@
AM_LIBTOOLFLAGS = --tag=disable-static
libexecsub_LTLIBRARIES = liblto_plugin.la
in_gcc_libs = $(foreach lib, $(libexecsub_LTLIBRARIES), $(gcc_build_dir)/$(lib))
@@ -685,6 +684,8 @@ uninstall-am: uninstall-libexecsubLTLIBRARIES
override CFLAGS := $(filter-out -fsanitize=address -fsanitize=hwaddress,$(CFLAGS))
override LDFLAGS := $(filter-out -fsanitize=address -fsanitize=hwaddress,$(LDFLAGS))
+@LTO_PLUGIN_USE_PTHREAD_TRUE@override LDFLAGS := $(LDFLAGS) -pthread
+
all-local: $(in_gcc_libs)
$(in_gcc_libs) : $(gcc_build_dir)/%: %
diff --git a/lto-plugin/configure b/lto-plugin/configure
index 870e49b2e62..bf7c4d064ee 100755
--- a/lto-plugin/configure
+++ b/lto-plugin/configure
@@ -650,6 +650,8 @@ LD
FGREP
SED
LIBTOOL
+LTO_PLUGIN_USE_PTHREAD_FALSE
+LTO_PLUGIN_USE_PTHREAD_TRUE
LTO_PLUGIN_USE_SYMVER_SUN_FALSE
LTO_PLUGIN_USE_SYMVER_SUN_TRUE
LTO_PLUGIN_USE_SYMVER_GNU_FALSE
@@ -6033,6 +6035,15 @@ fi
fi
+ if test "x$use_locking" = xyes; then
+ LTO_PLUGIN_USE_PTHREAD_TRUE=
+ LTO_PLUGIN_USE_PTHREAD_FALSE='#'
+else
+ LTO_PLUGIN_USE_PTHREAD_TRUE='#'
+ LTO_PLUGIN_USE_PTHREAD_FALSE=
+fi
+
+
case `pwd` in
*\ * | *\ *)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
@@ -12104,7 +12115,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 12118 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12210,7 +12221,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 12224 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12693,6 +12704,10 @@ if test -z "${LTO_PLUGIN_USE_SYMVER_SUN_TRUE}" && test -z "${LTO_PLUGIN_USE_SYMV
as_fn_error $? "conditional \"LTO_PLUGIN_USE_SYMVER_SUN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${LTO_PLUGIN_USE_PTHREAD_TRUE}" && test -z "${LTO_PLUGIN_USE_PTHREAD_FALSE}"; then
+ as_fn_error $? "conditional \"LTO_PLUGIN_USE_PTHREAD\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/lto-plugin/configure.ac b/lto-plugin/configure.ac
index 18eb4f60b0a..6ff5071c423 100644
--- a/lto-plugin/configure.ac
+++ b/lto-plugin/configure.ac
@@ -104,6 +104,8 @@ if test x$use_locking = xyes; then
[AC_DEFINE(HAVE_PTHREAD_LOCKING, 1, [Define if the system provides pthread locking mechanism.])])
fi
+AM_CONDITIONAL(LTO_PLUGIN_USE_PTHREAD, [test "x$use_locking" = xyes])
+
AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(target_noncanonical)
--
2.37.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] lto-plugin: use -pthread only for detected targets
2022-07-14 10:03 ` Martin Liška
@ 2022-07-14 10:10 ` Richard Biener
2022-07-14 11:13 ` Martin Liška
0 siblings, 1 reply; 6+ messages in thread
From: Richard Biener @ 2022-07-14 10:10 UTC (permalink / raw)
To: Martin Liška, Alexandre Oliva; +Cc: GCC Patches
On Thu, Jul 14, 2022 at 12:03 PM Martin Liška <mliska@suse.cz> wrote:
>
> On 7/13/22 14:15, Richard Biener wrote:
> > Didn't we have it that way and not work? IIRC LDFLAGS is only
> > used during configure link tests and _not_ substituted?
>
> You are right.
>
> There's a proper fix that utilizes AM_CONDITIONAL and sets LDFLAGS properly
> in Makefile.am.
>
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>
> Ready to be installed?
I'm not really an expert on build issues but I'd have added
some lto_plugin_extra_ldflags variable, AC_SUBST ()ed it
and done
AM_LDFLAGS = @lto_plugin_extra_ldflags@ @ac_lto_plugin_ldflags@
or figure where we set ac_lto_plugin_ldflags and amend that during
configure instead:
# Need -Wc to get it through libtool.
if test "x$have_static_libgcc" = xyes; then
ac_lto_plugin_ldflags="-Wc,-static-libgcc"
fi
AC_SUBST(ac_lto_plugin_ldflags)
> Thanks,
> Martin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] lto-plugin: use -pthread only for detected targets
2022-07-14 10:10 ` Richard Biener
@ 2022-07-14 11:13 ` Martin Liška
2022-07-14 11:22 ` Richard Biener
0 siblings, 1 reply; 6+ messages in thread
From: Martin Liška @ 2022-07-14 11:13 UTC (permalink / raw)
To: Richard Biener, Alexandre Oliva; +Cc: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 1059 bytes --]
On 7/14/22 12:10, Richard Biener wrote:
> On Thu, Jul 14, 2022 at 12:03 PM Martin Liška <mliska@suse.cz> wrote:
>>
>> On 7/13/22 14:15, Richard Biener wrote:
>>> Didn't we have it that way and not work? IIRC LDFLAGS is only
>>> used during configure link tests and _not_ substituted?
>>
>> You are right.
>>
>> There's a proper fix that utilizes AM_CONDITIONAL and sets LDFLAGS properly
>> in Makefile.am.
>>
>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>
>> Ready to be installed?
>
> I'm not really an expert on build issues but I'd have added
> some lto_plugin_extra_ldflags variable, AC_SUBST ()ed it
> and done
>
> AM_LDFLAGS = @lto_plugin_extra_ldflags@ @ac_lto_plugin_ldflags@
>
> or figure where we set ac_lto_plugin_ldflags and amend that during
> configure instead:
>
> # Need -Wc to get it through libtool.
> if test "x$have_static_libgcc" = xyes; then
> ac_lto_plugin_ldflags="-Wc,-static-libgcc"
> fi
> AC_SUBST(ac_lto_plugin_ldflags)
All right, so something like this?
Martin
>
>
>> Thanks,
>> Martin
[-- Attachment #2: 0001-lto-plugin-use-pthread-only-for-detected-targets.patch --]
[-- Type: text/x-patch, Size: 4588 bytes --]
From 248469bd1b35d2c87d751b1adbc07c784ebd4830 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Thu, 14 Jul 2022 09:51:33 +0200
Subject: [PATCH] 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: Append -pthread to LDFLAGS if
LTO_PLUGIN_USE_PTHREAD.
* configure.ac: Use AM_CONDITIONAL for LTO_PLUGIN_USE_PTHREAD.
* Makefile.in: Regenerate.
* configure: Regenerate.
---
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)
--
2.37.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] lto-plugin: use -pthread only for detected targets
2022-07-14 11:13 ` Martin Liška
@ 2022-07-14 11:22 ` Richard Biener
0 siblings, 0 replies; 6+ messages in thread
From: Richard Biener @ 2022-07-14 11:22 UTC (permalink / raw)
To: Martin Liška; +Cc: Alexandre Oliva, GCC Patches
On Thu, Jul 14, 2022 at 1:13 PM Martin Liška <mliska@suse.cz> wrote:
>
> On 7/14/22 12:10, Richard Biener wrote:
> > On Thu, Jul 14, 2022 at 12:03 PM Martin Liška <mliska@suse.cz> wrote:
> >>
> >> On 7/13/22 14:15, Richard Biener wrote:
> >>> Didn't we have it that way and not work? IIRC LDFLAGS is only
> >>> used during configure link tests and _not_ substituted?
> >>
> >> You are right.
> >>
> >> There's a proper fix that utilizes AM_CONDITIONAL and sets LDFLAGS properly
> >> in Makefile.am.
> >>
> >> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> >>
> >> Ready to be installed?
> >
> > I'm not really an expert on build issues but I'd have added
> > some lto_plugin_extra_ldflags variable, AC_SUBST ()ed it
> > and done
> >
> > AM_LDFLAGS = @lto_plugin_extra_ldflags@ @ac_lto_plugin_ldflags@
> >
> > or figure where we set ac_lto_plugin_ldflags and amend that during
> > configure instead:
> >
> > # Need -Wc to get it through libtool.
> > if test "x$have_static_libgcc" = xyes; then
> > ac_lto_plugin_ldflags="-Wc,-static-libgcc"
> > fi
> > AC_SUBST(ac_lto_plugin_ldflags)
>
> All right, so something like this?
LGTM with the changelog fixed
> Martin
>
> >
> >
> >> Thanks,
> >> Martin
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-07-14 11:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-13 8:23 [PATCH] lto-plugin: use -pthread only for detected targets Martin Liška
2022-07-13 12:15 ` Richard Biener
2022-07-14 10:03 ` Martin Liška
2022-07-14 10:10 ` Richard Biener
2022-07-14 11:13 ` Martin Liška
2022-07-14 11:22 ` Richard Biener
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).