bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: "Dmitry V. Levin" <ldv@altlinux.org>
Cc: bug-gnulib@gnu.org
Subject: Re: test-rwlock1 failing on latest Fedora Rawhide
Date: Thu, 24 Jan 2019 04:49:57 +0100	[thread overview]
Message-ID: <6764980.Kfckosteha@omega> (raw)
In-Reply-To: <1892008.H1GgYAAaXj@omega>

> (2) threadlib.m4 defines LIBMULTITHREAD in a way that is meant to defeat
>     -Wl,--as-needed. But it does not work, due to the reordering of
>     options done by libtool.

Let me take out the code that does not work.


2019-01-23  Bruno Haible  <bruno@clisp.org>

	threadlib: Revert commit from 2018-06-25. We now have a better fix.
	* m4/threadlib.m4 (gl_THREADLIB_BODY): Don't attempt to defeat a
	preceding -Wl,--as-needed option. Don't check whether the linker
	supports --as-needed/--no-as-needed and --push-state/--pop-state.

diff --git a/m4/threadlib.m4 b/m4/threadlib.m4
index f7841b6..bfc3bac 100644
--- a/m4/threadlib.m4
+++ b/m4/threadlib.m4
@@ -1,4 +1,4 @@
-# threadlib.m4 serial 15
+# threadlib.m4 serial 16
 dnl Copyright (C) 2005-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -151,36 +151,6 @@ int main ()
          *" -static "*) gl_cv_have_weak=no ;;
        esac
       ])
-    dnl Check whether the linker supports the --as-needed/--no-as-needed options.
-    dnl Assume GCC, so that we can use the -Wl option.
-    AC_CACHE_CHECK([whether the linker supports --as-needed],
-      [gl_cv_linker_have_as_needed],
-      [if test -n "$GCC"; then
-         gl_saved_ldflags="$LDFLAGS"
-         LDFLAGS="$gl_saved_ldflags -Wl,--as-needed -Wl,--no-as-needed"
-         AC_LINK_IFELSE([AC_LANG_PROGRAM()],
-           [gl_cv_linker_have_as_needed=yes],
-           [gl_cv_linker_have_as_needed=no])
-         LDFLAGS="$gl_saved_ldflags"
-       else
-         gl_cv_linker_have_as_needed=no
-       fi
-      ])
-    dnl Check whether the linker supports the --push-state/--pop-state options.
-    dnl Assume GCC, so that we can use the -Wl option.
-    AC_CACHE_CHECK([whether the linker supports --push-state],
-      [gl_cv_linker_have_push_state],
-      [if test -n "$GCC"; then
-         gl_saved_ldflags="$LDFLAGS"
-         LDFLAGS="$gl_saved_ldflags -Wl,--push-state -Wl,--pop-state"
-         AC_LINK_IFELSE([AC_LANG_PROGRAM()],
-           [gl_cv_linker_have_push_state=yes],
-           [gl_cv_linker_have_push_state=no])
-         LDFLAGS="$gl_saved_ldflags"
-       else
-         gl_cv_linker_have_push_state=no
-       fi
-      ])
     if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
       # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that
       # it groks <pthread.h>. It's added above, in gl_THREADLIB_EARLY_BODY.
@@ -259,32 +229,6 @@ int main ()
                 [Define if references to the POSIX multithreading library should be made weak.])
               LIBTHREAD=
               LTLIBTHREAD=
-              dnl On platforms where GCC enables --as-needed by default, attempt
-              dnl to make sure that LIBMULTITHREAD really links with -lpthread.
-              dnl Otherwise linking with LIBMULTITHREAD has no effect; then
-              dnl the weak symbols are not defined and thus evaluate to NULL.
-              case "$LIBMULTITHREAD" in
-                "") ;;
-                -pthread)
-                  if test $gl_cv_linker_have_as_needed = yes; then
-                    if test $gl_cv_linker_have_push_state = yes; then
-                      LIBMULTITHREAD="$LIBMULTITHREAD -Wl,--push-state -Wl,--no-as-needed -lpthread -Wl,--pop-state"
-                    else
-                      LIBMULTITHREAD="$LIBMULTITHREAD -Wl,--no-as-needed -lpthread"
-                    fi
-                  fi
-                  ;;
-                *)
-                  if test $gl_cv_linker_have_as_needed = yes; then
-                    if test $gl_cv_linker_have_push_state = yes; then
-                      LIBMULTITHREAD="-Wl,--push-state -Wl,--no-as-needed $LIBMULTITHREAD -Wl,--pop-state"
-                    else
-                      LIBMULTITHREAD="-Wl,--no-as-needed $LIBMULTITHREAD"
-                    fi
-                  fi
-                  ;;
-              esac
-              # TODO: May need to modify LTLIBMULTITHREAD similarly.
             fi
           fi
         fi
@@ -317,18 +261,6 @@ int main ()
               [Define if references to the old Solaris multithreading library should be made weak.])
             LIBTHREAD=
             LTLIBTHREAD=
-            dnl On platforms where GCC enables --as-needed by default, attempt
-            dnl to make sure that LIBMULTITHREAD really links with -lthread.
-            dnl Otherwise linking with LIBMULTITHREAD has no effect; then
-            dnl the weak symbols are not defined and thus evaluate to NULL.
-            if test $gl_cv_linker_have_as_needed = yes; then
-              if test $gl_cv_linker_have_push_state = yes; then
-                LIBMULTITHREAD="-Wl,--push-state -Wl,--no-as-needed $LIBMULTITHREAD -Wl,--pop-state"
-              else
-                LIBMULTITHREAD="-Wl,--no-as-needed $LIBMULTITHREAD"
-              fi
-            fi
-            # TODO: May need to modify LTLIBMULTITHREAD similarly.
           fi
         fi
       fi
@@ -357,18 +289,6 @@ int main ()
               [Define if references to the GNU Pth multithreading library should be made weak.])
             LIBTHREAD=
             LTLIBTHREAD=
-            dnl On platforms where GCC enables --as-needed by default, attempt
-            dnl to make sure that LIBMULTITHREAD really links with -lpth.
-            dnl Otherwise linking with LIBMULTITHREAD has no effect; then
-            dnl the weak symbols are not defined and thus evaluate to NULL.
-            if test $gl_cv_linker_have_as_needed = yes; then
-              if test $gl_cv_linker_have_push_state = yes; then
-                LIBMULTITHREAD="-Wl,--push-state -Wl,--no-as-needed $LIBMULTITHREAD -Wl,--pop-state"
-              else
-                LIBMULTITHREAD="-Wl,--no-as-needed $LIBMULTITHREAD"
-              fi
-            fi
-            # TODO: May need to modify LTLIBMULTITHREAD similarly.
           fi
         fi
       else



  reply	other threads:[~2019-01-24  4:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-23 19:37 test-rwlock1 failing on latest Fedora Rawhide Richard W.M. Jones
2019-01-23 20:01 ` Bruno Haible
2019-01-23 20:45   ` Richard W.M. Jones
2019-01-23 21:03     ` Dmitry V. Levin
2019-01-23 21:14       ` Richard W.M. Jones
2019-01-23 22:09         ` Dmitry V. Levin
2019-01-23 22:24           ` Richard W.M. Jones
2019-01-23 22:38             ` Dmitry V. Levin
2019-01-24  3:18               ` Bruno Haible
2019-01-24  3:31                 ` Bruno Haible
2019-01-24  3:49                   ` Bruno Haible [this message]
2019-01-24  8:57                     ` Richard W.M. Jones
2019-01-24  8:50               ` Richard W.M. Jones
2019-01-23 21:17       ` Michael Hudson-Doyle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6764980.Kfckosteha@omega \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=ldv@altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).