Note that the third case worked because the use of `-Wl,--whole-archive -lpthread -Wl,--no-whole-archive' is a workaround that evidently results in the TLS (Thread-Local Storage) being initialised properly.
The root cause of this bug is currently uncertain, but https://gcc.gnu.org/ml/gcc-help/2010-05/msg00029.html could be relevant.
Note that the third case worked because the use of `-Wl,-- whole-archive -lpthread -Wl,--no- whole-archive' is a workaround that evidently results in the TLS (Thread-Local Storage) being initialised properly.
The root cause of this bug is currently uncertain, but https:/ /gcc.gnu. org/ml/ gcc-help/ 2010-05/ msg00029. html could be relevant.