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