like so many other bugs, "-shared -pthread" is broken on mips linux: $ mips-linux-gcc -dumpspecs ... %{!shared: %{pthread:-lpthread} ... ... simple fix until a general solution (as proposed in Bug 20705) is implemented: --- gcc/config/mips/linux.h +++ gcc/config/mips/linux.h @@ -175,7 +175,7 @@ #undef LIB_SPEC #define LIB_SPEC "\ %{shared: -lc} \ -%{!shared: %{pthread:-lpthread} \ - %{profile:-lc_p} %{!profile: -lc}}" +%{pthread:-lpthread} \ +%{!shared: %{profile:-lc_p} %{!profile: -lc}}" #define MD_UNWIND_SUPPORT "config/mips/linux-unwind.h" --- gcc/config/mips/linux64.h +++ gcc/config/mips/linux64.h @@ -33,8 +33,8 @@ #undef LIB_SPEC #define LIB_SPEC "\ %{shared: -lc} \ -%{!shared: %{pthread:-lpthread} \ - %{profile:-lc_p} %{!profile: -lc}}" +%{pthread:-lpthread} \ +%{!shared: %{profile:-lc_p} %{!profile: -lc}}" #define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1" #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld.so.1" this follows the same lines as all other Linux arches: http://gcc.gnu.org/ml/gcc-patches/2002-12/msg00526.html
Patches should be sent to gcc-patches@gcc.gnu.org
FWIW, this was fixed on mainline by: 2007-06-13 Thiemo Seufer <ths@networkno.de> * config/mips/linux.h, config/mips/linux64.h (LIB_SPEC): Always imply -lpthread for -pthread. By the letter of the law, this shouldn't be backported because it doesn't fix a regression. Interested parties: please shout if you think an exception should be made. Richard
this is in gcc-4.3.0 and that's fine by me