I do believe this to be a regression from gcc 4.4.0. If --enable-threads is used, pthread references appear to get auto-imported, -lpthread is not passed to libgcc, and the build fails with undefined references to libpthread in libgcc. This occurs in 32-bit multilib, as well, despite the presence of 32-bit libpthread.a or in 64-bit (multilib disabled or not) libpthread.a or libpthread.dll.a. For example, in Cygwin, 32-bit libgcc: gcc -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -DNATIVE_CROSS -W -Wall -Wwrite-stri ngs -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attrib ute -Wold-style-definition -fno-common -DHAVE_CONFIG_H -Wl,--stack,8388608 -o c c1.exe c-lang.o stub-objc.o attribs.o c-errors.o c-lex.o c-pragma.o c-decl.o c-t ypeck.o c-convert.o c-aux-info.o c-common.o c-opts.o c-format.o c-semantics.o c- ppoutput.o c-cppbuiltin.o c-objc-common.o c-dump.o c-pch.o c-parser.o i386-c.o m sformat-c.o c-gimplify.o tree-mudflap.o c-pretty-print.o c-omp.o \ cc1-checksum.o main.o tree-browser.o libbackend.a ../libcpp/libcpp.a . ./libdecnumber/libdecnumber.a ../libcpp/libcpp.a /usr/lib/libintl.a /usr/lib/lib iconv.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -lmpc -lmpfr -lgmp /home/Peter/gcc-trunk/build-149397-20090607/./gcc/xgcc -B/home/Peter/gcc-trunk/b uild-149397-20090607/./gcc/ -L/home/Peter/gcc-trunk/build-149397-20090607/x86_64 -w64-mingw32/32/winsup/mingw -L/home/Peter/gcc-trunk/build-149397-20090607/x86_6 4-w64-mingw32/32/winsup/w32api/lib -isystem /home/Peter/gcc-trunk/winsup/mingw/i nclude -isystem /home/Peter/gcc-trunk/winsup/w32api/include -B/usr/x86_64-w64-mi ngw32/bin/ -B/usr/x86_64-w64-mingw32/lib/ -isystem /usr/x86_64-w64-mingw32/inclu de -isystem /usr/x86_64-w64-mingw32/sys-include -m32 -dumpspecs > tmp-specs mv tmp-specs specs /home/Peter/gcc-trunk/build-149397-20090607/./gcc/xgcc -B/home/Peter/gcc-trunk/b uild-149397-20090607/./gcc/ -L/home/Peter/gcc-trunk/build-149397-20090607/x86_64 -w64-mingw32/32/winsup/mingw -L/home/Peter/gcc-trunk/build-149397-20090607/x86_6 4-w64-mingw32/32/winsup/w32api/lib -isystem /home/Peter/gcc-trunk/winsup/mingw/i nclude -isystem /home/Peter/gcc-trunk/winsup/w32api/include -B/usr/x86_64-w64-mi ngw32/bin/ -B/usr/x86_64-w64-mingw32/lib/ -isystem /usr/x86_64-w64-mingw32/inclu de -isystem /usr/x86_64-w64-mingw32/sys-include -m32 -O2 -I../../gcc/../winsup/ w32api/include -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -DNATIVE_CROSS -W -Wall -W write-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-d efinition -isystem ./include -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOA T_NOT_NEEDED -g \ -msse -minline-all-stringops -c \ ../../gcc/config/i386/crtfastmath.c \ -o /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw3 2/32/libgcc/crtfastmath.o make[1]: Leaving directory `/home/Peter/gcc-trunk/build-149397-20090607/gcc' # Early copyback; see "all" above for the rationale. The # early copy is necessary so that the gcc -B options find # the right startup files when linking shared libgcc. /bin/sh ../../../../libgcc/../mkinstalldirs ../../.././gcc/32 parts="crtfastmath.o"; \ for file in $parts; do \ rm -f ../../.././gcc/32/$file; \ /usr/bin/install -c -m 644 $file ../../.././gcc/32/; \ done { /home/Peter/gcc-trunk/build-149397-20090607/./gcc/nm -pg _chkstk_s.o _muldi3_s .o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _ clear_cache_s.o _enable_execute_stack_s.o _trampoline_s.o __main_s.o _absvsi2_s. o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s .o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi 2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _ powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3 _s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _fixunssfsi _s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fix unssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _floatdidf_s.o _float dixf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _divdi3_s.o _moddi3_ s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o addtf3_s.o divtf3 _s.o eqtf2_s.o getf2_s.o letf2_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi _s.o floatditf_s.o floatunditf_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s .o trunctfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o tf-signs_s.o unwind-dw2_s.o unwi nd-dw2-fde_s.o unwind-sjlj_s.o gthr-gnat_s.o unwind-c_s.o emutls_s.o; echo %%; \ cat ../../../../libgcc/../gcc/libgcc-std.ver \ | sed -e '/^[ ]*#/d' \ -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \ | /home/Peter/gcc-trunk/build-149397-20090607/./gcc/xgcc -B/home/Pet er/gcc-trunk/build-149397-20090607/./gcc/ -L/home/Peter/gcc-trunk/build-149397-2 0090607/x86_64-w64-mingw32/32/winsup/mingw -L/home/Peter/gcc-trunk/build-149397- 20090607/x86_64-w64-mingw32/32/winsup/w32api/lib -isystem /home/Peter/gcc-trunk/ winsup/mingw/include -isystem /home/Peter/gcc-trunk/winsup/w32api/include -B/usr /x86_64-w64-mingw32/bin/ -B/usr/x86_64-w64-mingw32/lib/ -isystem /usr/x86_64-w64 -mingw32/include -isystem /usr/x86_64-w64-mingw32/sys-include -m32 -g -O2 -I../ ../gcc/../winsup/w32api/include -g -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -DNATIV E_CROSS -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prot otypes -Wold-style-definition -isystem ./include -g -DHAVE_GTHR_DEFAULT -DIN_ LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -I. -I. -I../../.././gcc -I../../../../libgcc -I../../../../libgcc/. -I../../../../libgcc/../gcc -I../../../../libgcc/../incl ude -DHAVE_CC_TLS -E -xassembler-with-cpp -; \ } | gawk -f ../../../../libgcc/../gcc/mkmap-flat.awk -v pe_dll=libgcc_s _sjlj-1.dll > tmp-libgcc.map mv tmp-libgcc.map libgcc.map # @multilib_flags@ is still needed because this may use # /home/Peter/gcc-trunk/build-149397-20090607/./gcc/xgcc -B/home/Peter/gcc-trunk /build-149397-20090607/./gcc/ -L/home/Peter/gcc-trunk/build-149397-20090607/x86_ 64-w64-mingw32/32/winsup/mingw -L/home/Peter/gcc-trunk/build-149397-20090607/x86 _64-w64-mingw32/32/winsup/w32api/lib -isystem /home/Peter/gcc-trunk/winsup/mingw /include -isystem /home/Peter/gcc-trunk/winsup/w32api/include -B/usr/x86_64-w64- mingw32/bin/ -B/usr/x86_64-w64-mingw32/lib/ -isystem /usr/x86_64-w64-mingw32/inc lude -isystem /usr/x86_64-w64-mingw32/sys-include -m32 and -O2 -I../../gcc/../w insup/w32api/include -g -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -DNATIVE_CROSS -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wol d-style-definition -isystem ./include -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D_ _GCC_FLOAT_NOT_NEEDED directly. # @multilib_dir@ is not really necessary, but sometimes it has # more uses than just a directory name. /bin/sh ../../../../libgcc/../mkinstalldirs 32 ln -s -f libgcc.map libgcc.map.def && if [ ! -d 32/shlib ]; then mkdir 32/shlib; else true; fi && /home/Peter/gcc-trunk/build-149397-20090607/./gcc/xgcc -B/home /Peter/gcc-trunk/build-149397-20090607/./gcc/ -L/home/Peter/gcc-trunk/build-1493 97-20090607/x86_64-w64-mingw32/32/winsup/mingw -L/home/Peter/gcc-trunk/build-149 397-20090607/x86_64-w64-mingw32/32/winsup/w32api/lib -isystem /home/Peter/gcc-tr unk/winsup/mingw/include -isystem /home/Peter/gcc-trunk/winsup/w32api/include -B /usr/x86_64-w64-mingw32/bin/ -B/usr/x86_64-w64-mingw32/lib/ -isystem /usr/x86_64 -w64-mingw32/include -isystem /usr/x86_64-w64-mingw32/sys-include -m32 -O2 -I.. /../gcc/../winsup/w32api/include -g -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -DNATI VE_CROSS -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-pro totypes -Wold-style-definition -isystem ./include -g -DHAVE_GTHR_DEFAULT -DIN _LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -shared -nodefaultlibs libgcc.map.def -Wl,--o ut-implib,32/shlib/libgcc_s.a.tmp -o 32/shlib/libgcc_s_sjlj-1.dll.tmp -g -B./ _c hkstk_s.o _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2 _s.o _ucmpdi2_s.o _clear_cache_s.o _enable_execute_stack_s.o _trampoline_s.o __m ain_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi 3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_ tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2 _s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswap di2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s. o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _f loatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _ divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s. o addtf3_s.o divtf3_s.o eqtf2_s.o getf2_s.o letf2_s.o multf3_s.o negtf2_s.o subt f3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fix tfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o extendsftf2_s.o extenddftf 2_s.o extendxftf2_s.o trunctfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o tf-signs_s.o unwind-dw2_s.o unwind-dw2-fde_s.o unwind-sjlj_s.o gthr-gnat_s.o unwind-c_s.o emu tls_s.o -lmingw32 -lmingwex -lmoldname -lmsvcrt -luser32 -lkernel32 -ladvapi32 - lshell32 && if [ -f 32/shlib/libgcc_s_sjlj-1.dll ]; then mv -f 32/shlib/libgcc_s _sjlj-1.dll 32/shlib/libgcc_s_sjlj-1.dll.backup; else true; fi && mv 32/shlib/li bgcc_s_sjlj-1.dll.tmp 32/shlib/libgcc_s_sjlj-1.dll && mv 32/shlib/libgcc_s.a.tmp 32/shlib/libgcc_s.a Creating library file: 32/shlib/libgcc_s.a.tmp unwind-dw2-fde_s.o: In function `__gthread_mutex_lock': /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:758: undefined reference to `__imp__pthread_mute x_lock' unwind-dw2-fde_s.o: In function `__gthread_mutex_unlock': /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:790: undefined reference to `__imp__pthread_mute x_unlock' unwind-dw2-fde_s.o: In function `__gthread_mutex_lock': /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:758: undefined reference to `__imp__pthread_mute x_lock' unwind-dw2-fde_s.o: In function `__gthread_mutex_unlock': /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:790: undefined reference to `__imp__pthread_mute x_unlock' unwind-dw2-fde_s.o: In function `__gthread_mutex_lock': /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:758: undefined reference to `__imp__pthread_mute x_lock' unwind-dw2-fde_s.o: In function `__gthread_mutex_unlock': /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:790: undefined reference to `__imp__pthread_mute x_unlock' /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:790: undefined reference to `__imp__pthread_mute x_unlock' unwind-dw2-fde_s.o: In function `__gthread_mutex_lock': /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:758: undefined reference to `__imp__pthread_mute x_lock' unwind-dw2-fde_s.o: In function `__gthread_mutex_unlock': /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:790: undefined reference to `__imp__pthread_mute x_unlock' /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:790: undefined reference to `__imp__pthread_mute x_unlock' unwind-sjlj_s.o: In function `__gthread_once': /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:716: undefined reference to `__imp__pthread_once ' unwind-sjlj_s.o: In function `__gthread_key_create': /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:724: undefined reference to `__imp__pthread_key_ create' unwind-sjlj_s.o: In function `__gthread_setspecific': /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:742: undefined reference to `__imp__pthread_sets pecific' /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:742: undefined reference to `__imp__pthread_sets pecific' unwind-sjlj_s.o: In function `__gthread_getspecific': /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:736: undefined reference to `__imp__pthread_gets pecific' unwind-sjlj_s.o: In function `__gthread_setspecific': /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:742: undefined reference to `__imp__pthread_sets pecific' /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:742: undefined reference to `__imp__pthread_sets pecific' unwind-sjlj_s.o: In function `__gthread_getspecific': /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:736: undefined reference to `__imp__pthread_gets pecific' /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:736: undefined reference to `__imp__pthread_gets pecific' /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:736: undefined reference to `__imp__pthread_gets pecific' /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:736: undefined reference to `__imp__pthread_gets pecific' /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:736: undefined reference to `__imp__pthread_gets pecific' emutls_s.o: In function `__gthread_key_create': /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:724: undefined reference to `__imp__pthread_key_ create' emutls_s.o: In function `__gthread_getspecific': /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:736: undefined reference to `__imp__pthread_gets pecific' emutls_s.o: In function `__gthread_once': /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:716: undefined reference to `__imp__pthread_once ' emutls_s.o: In function `__gthread_mutex_lock': /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:758: undefined reference to `__imp__pthread_mute x_lock' emutls_s.o: In function `__gthread_mutex_unlock': /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:790: undefined reference to `__imp__pthread_mute x_unlock' emutls_s.o: In function `__gthread_setspecific': /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:742: undefined reference to `__imp__pthread_sets pecific' /home/Peter/gcc-trunk/build-149397-20090607/x86_64-w64-mingw32/32/libgcc/../../. ./../libgcc/../gcc/gthr-posix.h:742: undefined reference to `__imp__pthread_sets pecific' collect2: ld returned 1 exit status make: *** [libgcc_s.dll] Error 1
gcc versions before 4.7 are supporting just win32 threading. Beginning with upcoming version you can use threading-model posix, if you are using adequate pthread implementation for windows targets. So close this bug.