[Bug libstdc++/58909] C++11's condition variables fail with static linking

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Feb 14 10:51:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58909

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Well Roland's fix doesn't work, and his claims about libstdc++ problems are
based on ancient history, so I don't find his arguments very persuasive.

I'm happy to document the requirements in the libstdc++ manual, there's no
downside to that.

We can also avoid weak symbols for some functions that are only referenced from
headers, e.g. pthread_call_once. We only need the weak symbols in definitions
that end up in libstdc++.so and libstdc++.a, so that those libraries don't
unconditionally depend on libphtread. But if user code instantiates the
std::call_once function template then they should get a dependency on
pthread_call_once, because they're actually using it. Going via the
__gthread_call_once weak symbol has no benefit in that case. But the
std::condition_variable definitions are in the library, and so we do need to
use weak symbols for the cases involved in this PR.


More information about the Gcc-bugs mailing list