gcc-4.4-20081003 and later configured with --disable-shared for mingw32 attempt to link with libgcc_eh.a even though it never built libgcc_eh.a (those object files are included in libgcc.a): /home/mikpe/gcc-4.4-20081031/configure --target=x86_64-pc-mingw32 --prefix=/tmp/cross-mingw64 --disable-nls --disable-shared --enable-threads=win32 --enable-languages=c --with-gmp=/opt/local/gmp-4.2.4 --with-mpfr=/opt/local/mpfr-2.3.2 --disable-win32-registry --enable-sjlj-exceptions make make install echo "int main(void) { return 0; }" > trivial.c /tmp/cross-mingw64/bin/x86_64-pc-mingw32-gcc trivial.c /tmp/cross-mingw64/lib/gcc/x86_64-pc-mingw32/4.4.0/../../../../x86_64-pc-mingw32/bin/ld: cannot find -lgcc_eh collect2: ld returned 1 exit status The fix for PR37528 changed mingw32.h to #define REAL_LIBGCC_SPEC, and it also changed it to unconditionally link with -lgcc_eh for !shared-libgcc. That only works if libgcc_eh.a actually was built, which isn't the case when gcc was configured with --disable-shared.
Created attachment 16610 [details] patch to unbreak --disable-shared on mingw32 Proposed patch to unbreak --disable-shared on mingw32. When PR37528 changed mingw32.h to #define REAL_LIBGCC_SPEC it also bypassed gcc/gcc.c's logic to only link with -lgcc_eh when ENABLE_SHARED_LIBGCC is defined. So my proposed fix adds that logic to mingw32.h's definition of REAL_LIBGCC_SPEC. Tested on WinXP64 under cygwin both with and without --disable-shared.
Created attachment 16614 [details] revised patch to quard with ENABLE_SHARED_LIBGCC Hi Mikael, I have modified your patch slightly and added a ChangeLog entry. It works for me with host=build=target=mingw32. Does attached it work for you. Danny
(In reply to comment #2) Danny, I've tested the revised patch both with and without --disable-shared, and both configs build and work fine.
Subject: Bug 37989 Author: dannysmith Date: Tue Nov 4 02:16:07 2008 New Revision: 141575 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141575 Log: 2008-11-03 Mikael Pettersson <mikpe@it.uu.se> PR target/37989 * config/i386/mingw32.h (REAL_LIBGCC_SPEC): Only add libgcc_s.a or libgcc_eh.a to spec if ENABLE_SHARED_LIBGCC. Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/mingw32.h
Fixed by Mikael's patch