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: Bruno Haible
Subject: Re: threadlib vs as-needed vs libtool
Date: Wed, 01 Aug 2018 13:06:10 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-130-generic; KDE/5.18.0; x86_64; ; )

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

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.

Bruno




reply via email to

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