This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch/mingw32] : Fix PR target/37528.


The heuristics in  gcc.c:init_gcc_specs do not seem to accomodate an OS like
mingw32 for which shared libraries do not admit undefined symbols. Thus,
the -shared option for building a dll will often fail, following the
init_gcc_specs logic, becase only "shared_name" (and not inclusion of the
"other" functions in libgcc  via "static_name" ) will be provided.


Rather than confuse init_gcc_specs further, I think it is safer to
define REAL_LIBGCC_SPEC for mingw32, to allow windows-specific rules.
Because a shared libgcc is already a big step in many mingw32 eyes, I
have conservatively required an explicit -shared-libgcc switch to enable
libgcc_s on mingw. regardless of whether we are building an exe or a
dll. Perhaps later, mingw users will want to default to shared-libgcc,
at least for dll builds, but in that case  we will still need to ensure that
the static libgcc.a functions can be resolved in  .dll as well as .exe builds.

2008-10-02  Danny Smith  <dannysmith@users.sourceforge.net>

	PR target/37528
	* config/i386/mingw32.h (LIBGCC_SPEC) : Replace with ..
	(REAL_LIBGCC_SPEC): New.  Always include -lgcc.

Index: config/i386/mingw32.h
===================================================================
--- config/i386/mingw32.h	(revision 140821)
+++ config/i386/mingw32.h	(working copy)
@@ -89,10 +89,12 @@
   %(shared_libgcc_undefs)"

 /* Include in the mingw32 libraries with libgcc */
-#undef LIBGCC_SPEC
-#define LIBGCC_SPEC \
+#undef REAL_LIBGCC_SPEC
+#define REAL_LIBGCC_SPEC \
   "-lmingw32 \
-   %{shared-libgcc:-lgcc_s} -lgcc \
+   %{shared-libgcc:-lgcc_s} \
+   %{!shared-libgcc:-lgcc_eh} \
+   -lgcc \
    -lmoldname -lmingwex -lmsvcrt"

 #undef STARTFILE_SPEC


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]