https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87189
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Paul Pluzhnikov from comment #4) > (In reply to Jakub Jelinek from comment #3) > > This is a glibc bug > > I (obviously) disagree. > > , 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. > > If you call pthread_mutex_lock (or any other function) via weakref, then you > should ensure that the function is actually available. > > AFAICT, libgcc only calls a few pthread_* functions. Why is it hard to check > that *all* of them are present? Because it is very expensive. Each of those tests requires a dynamic relocation, GOT read every time it is checked, bloats the code size, etc.