https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67791
--- Comment #17 from Jonathan Wakely <redi at gcc dot gnu.org> --- GCC 9 hasn't changed, so it must be something in your Ubuntu environment or your code. I don't think the RTLD_xxx approach was ever robust, the libpthread.so library needs to be loaded before the first __gthread_active_p() check in the whole executable. That can be achieved by linking the executable to libpthread or preloading it. Or using a newer glibc where libpthread.so is empty and all the pthreads functions live in libc.so anyway.