#define LIB_SPEC "%{pg:-lgmon} %{mwindows:-lgdi32 -lcomdlg32} \
-luser32 -lkernel32 -ladvapi32 -lshell32"
-/* Include in the mingw32 libraries with libgcc */
-#undef LINK_SPEC
+/* Weak symbols do not get resolved if using a Windows dll import lib.
+ Make the unwind registration references strong undefs. */
+#if DWARF2_UNWIND_INFO
+#define SHARED_LIBGCC_UNDEFS_SPEC \
+ "%{shared-libgcc: -u ___register_frame_info -u ___deregister_frame_info}"
+#else
+#define SHARED_LIBGCC_UNDEFS_SPEC ""
+#endif
+
+#undef SUBTARGET_EXTRA_SPECS
+#define SUBTARGET_EXTRA_SPECS \
+ { "shared_libgcc_undefs", SHARED_LIBGCC_UNDEFS_SPEC }
+
#define LINK_SPEC "%{mwindows:--subsystem windows} \
%{mconsole:--subsystem console} \
%{shared: %{mdll: %eshared and mdll are not compatible}} \
%{shared: --shared} %{mdll:--dll} \
%{static:-Bstatic} %{!static:-Bdynamic} \
- %{shared|mdll: -e _DllMainCRTStartup@12}"
+ %{shared|mdll: -e _DllMainCRTStartup@12 --enable-auto-image-base} \
+ %(shared_libgcc_undefs)"
/* Include in the mingw32 libraries with libgcc */
#undef LIBGCC_SPEC
#define LIBGCC_SPEC \
- "%{mthreads:-lmingwthrd} -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt"
+ "-lmingw32 \
+ %{shared-libgcc:-lgcc_s} -lgcc \
+ -lmoldname -lmingwex -lmsvcrt"
#undef STARTFILE_SPEC
#define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \
#if !TARGET_64BIT
#define MD_UNWIND_SUPPORT "config/i386/w32-unwind.h"
#endif
+
+/* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygming. */
+#define LIBGCC_SONAME "libgcc_s_1.dll"