https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95989
Florian Weimer <fw at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fw at gcc dot gnu.org --- Comment #9 from Florian Weimer <fw at gcc dot gnu.org> --- Jonathan and I discussed this off this bug. The issue is the weak declaration of pthread_self in the libstdc++ headers. For glibc (at least since 2.1, possibly 2.0), there is no reason to have a weak declaration because the symbol lives in libc itself, so it is always available (both with static and dynamic linking). But if the symbol reference is weak and the symbol is not pulled in for some other reason, then the function is not linked in even if it is called.