Re: Linking with -pthread only if linking with a .so that needs it

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

 



Florian Weimer writes:

* Sam Varshavchik:

> libcxx.so gets built by gcc.7.3.1 with -std=c++17 -O2
> -fvisibility-inlines- hidden, -fno-omit-frame-pointer, and
> -pthread. It contains some static variables that are instantiated
> templates. It contains other static variables whose constructors
> invoke the instantiated templates' methods that construct and
> destruct std::unique_lock<std::mutex> of std::mutexes that are
> static variables of the instantiated templates. Static
> initialization of libcxx.so does not create any execution thread.

What's the binding type for __pthread_key_create in libcxx.so?  I
assume that's the symbol used as a key for __gthread_active_p.

It's whatever it inherited from <thread>. None of the translation units directly call pthread_key_create(). They construct std::thread, std::mutex, std::recursive_mutex, std::condition_variable, and std::lock and std::lock_guard, for the mutexes.

So, I would expect that the translation units that construct a std::thread will have a strong binding, and other translation units will have a weak one. This was also true for the code that links with libcxx.so

I now moved up to gcc 8, and will see if this also occurs with gcc 8.

Attachment: pgpUXnw4LLUMM.pgp
Description: PGP signature


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux