Patchwork [mingw] : Cleanup about static/shared libgcc

login
register
mail settings
Submitter Kai Tietz
Date Nov. 29, 2012, 10:12 a.m.
Message ID <CAEwic4ZDVqfZeDo=HvwTiHY9qd055UDwKBhoxNCeydxp7EYt1w@mail.gmail.com>
Download mbox | patch
Permalink /patch/202694/
State New
Headers show

Comments

Kai Tietz - Nov. 29, 2012, 10:12 a.m.
Hi,

this patch synchronize handling - and fixes latent bug - of
static/shared flags with cygwin-host.
in static case prior code added to linker-script reference to shared
libgcc, which is obviously wrong.
Due link-order the shared version doesn't get actual linked, but
nevertheless there is a latent issue.

ChangeLog

2012-11-29  Kai Tietz

	* config/i386/mingw32.h (SHARED_LIBGCC_SPEC): Synchronize with
	cygwin-host.

Tested for i686-w64-mingw32, and x86_64-w64-mingw32.  I will apply
tomorrow if there aren't any objections.

Regards,
Kai

 #undef STARTFILE_SPEC

Patch

Index: mingw32.h
===================================================================
--- mingw32.h	(Revision 193925)
+++ mingw32.h	(Arbeitskopie)
@@ -121,15 +121,24 @@ 

 /* Include in the mingw32 libraries with libgcc */
 #ifdef ENABLE_SHARED_LIBGCC
-#define SHARED_LIBGCC_SPEC "%{shared-libgcc:-lgcc_s}
%{!shared-libgcc:-lgcc_eh}"
+#define SHARED_LIBGCC_SPEC " \
+ %{static|static-libgcc:-lgcc -lgcc_eh} \
+ %{!static: \
+   %{!static-libgcc: \
+     %{!shared: \
+       %{!shared-libgcc:-lgcc -lgcc_eh} \
+       %{shared-libgcc:-lgcc_s -lgcc} \
+      } \
+     %{shared:-lgcc_s -lgcc} \
+    } \
+  } "
 #else
-#define SHARED_LIBGCC_SPEC /*empty*/
+#define SHARED_LIBGCC_SPEC " -lgcc "
 #endif
 #undef REAL_LIBGCC_SPEC
 #define REAL_LIBGCC_SPEC \
   "%{mthreads:-lmingwthrd} -lmingw32 \
    "SHARED_LIBGCC_SPEC" \
-   -lgcc \
    -lmoldname -lmingwex -lmsvcrt"