https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87189
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- This is a glibc bug, coming up with a set of weakref checks for gthr.h that would satisfy static linking of glibc and all possible combinations of included vs. non-included objects is impossible. E.g. Fedora/RHEL ld -r libpthread.a objects into a single exactly because of this. The other alternative is to add (for libpthread.a) dependencies in betweeh the *.o objects so that a reasonable set is always linked together, or just link with --whole-archive -lpthread --no-whole-archive. There are many dups of this both on the gcc side and glibc side.