bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: threadlib vs as-needed vs libtool


From: Michael Hudson-Doyle
Subject: Re: threadlib vs as-needed vs libtool
Date: Thu, 2 Aug 2018 11:11:43 +1200

Thanks for the reply.

On Wed, 1 Aug 2018 at 23:06, Bruno Haible <address@hidden> wrote:
Hi,

Michael Hudson-Doyle wrote:
> I recently encountered the problem that the patch "threadlib: Fix
> LIBMULTITHREAD on platforms where --as-needed is enabled" was intended to
> fix. But unfortunately, the fix doesn't actually work because libtool is
> re-ordering the linker commands. In particular "$stuff -Wl,--push-state
> -Wl,--no-as-needed -lpthread -Wl,--pop-state" becomes "-Wl,--push-state
> -Wl,--no-as-needed -Wl,--pop-state $stuff -lpthread" which obviously
> doesn't achieve anything at all.

It sounds like you are using $(LIBMULTITHREAD) when you should in fact
be using $(LTLIBMULTITHREAD). See the module description:

  Link:
  $(LTLIBMULTITHREAD) when linking with libtool, $(LIBMULTITHREAD) otherwise

This doesn't seem to help. If it did, though, should modules/lock-test and so on be updated to use LTLIBMULTITHREAD? I'm just a distro maintainer stabbing in the dark here!
 
The way things should work when using libtool is in use is that
  * libtool does not see any --push-state or --as-needed options, only
    -lpthread or -pthread.
  * libtool passes these options to GCC.
  * GCC inserts the --push-state and --as-needed options.

 I don't understand why gcc would do that?

Cheers,
mwh

reply via email to

[Prev in Thread] Current Thread [Next in Thread]