summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaakov Selkowitz <yselkowitz@users.sourceforge.net>2014-08-24 13:50:50 -0500
committerYaakov Selkowitz <yselkowitz@users.sourceforge.net>2014-08-24 13:50:50 -0500
commit25dac2f6a188420c39e8b6966b7f7cf74e6edbc0 (patch)
tree7bb3c5920df6f1013381a27018bfeaede25a712c
parentf2b77320b2bca5b4fa54f91781150da194a350a9 (diff)
downloadcygwin-gcc-25dac2f6a188420c39e8b6966b7f7cf74e6edbc0.tar.gz
cygwin-gcc-25dac2f6a188420c39e8b6966b7f7cf74e6edbc0.tar.xz
cygwin-gcc-25dac2f6a188420c39e8b6966b7f7cf74e6edbc0.zip
Separate Win32 patch for __cxa_thread_atexit.
-rw-r--r--cygwin-gcc.spec15
-rw-r--r--gcc48-__cxa_atexit.patch47
-rw-r--r--gcc48-libstdc-atexit_thread.patch83
3 files changed, 91 insertions, 54 deletions
diff --git a/cygwin-gcc.spec b/cygwin-gcc.spec
index 680444e..801b26f 100644
--- a/cygwin-gcc.spec
+++ b/cygwin-gcc.spec
@@ -7,7 +7,7 @@
%global gcc_version %{gcc_major}.%{gcc_minor}.%{gcc_micro}
# Note, gcc_release must be integer, if you want to add suffixes to
# %%{release}, append them after %%{gcc_release} on Release: line.
-%global gcc_release 3
+%global gcc_release 5
%global build_ada 0
# building cross-gnat requires matching X.Y version of native gnat
@@ -21,7 +21,7 @@
Name: cygwin-gcc
Version: %{gcc_version}
-Release: %{gcc_release}.1%{?dist}
+Release: %{gcc_release}%{?dist}
Summary: Cygwin GCC cross-compiler
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions
@@ -61,6 +61,7 @@ Patch23: gcc48-Wimplicit-decls.patch
Patch24: gcc49-default-manifest.patch
Patch25: gcc48-libgcc-deregister.patch
Patch26: gcc48-__cxa_atexit.patch
+Patch27: gcc48-libstdc-atexit_thread.patch
%description
@@ -199,6 +200,7 @@ Cygwin cross-compiler for Ada.
%patch24 -p0
%patch25 -p0
%patch26 -p2
+%patch27 -p0
echo %{gcc_version} > gcc/BASE-VER
echo 'Fedora Cygwin %{gcc_version}-%{gcc_release}' > gcc/DEV-PHASE
@@ -281,10 +283,6 @@ popd
%find_lang cygwin32-cpplib
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-
%files -n cygwin32-gcc -f cygwin32-gcc.lang
%{_bindir}/%{cygwin32_target}-gcc
%{_bindir}/%{cygwin32_target}-gcc-%{version}
@@ -408,7 +406,10 @@ rm -rf $RPM_BUILD_ROOT
%changelog
-* Thu Aug 07 2014 Yaakov Selkowitz <yselkowi@redhat.com> - 4.8.3-3.1
+* Mon Aug 11 2014 Yaakov Selkowitz <yselkowi@redhat.com> - 4.8.3-5
+- Separate Win32 patch for __cxa_thread_atexit.
+
+* Thu Aug 07 2014 Yaakov Selkowitz <yselkowi@redhat.com> - 4.8.3-4
- Build with --enable-__cxa_atexit
* Wed Jul 30 2014 Yaakov Selkowitz <yselkowitz@cygwin.com> - 4.8.3-3
diff --git a/gcc48-__cxa_atexit.patch b/gcc48-__cxa_atexit.patch
index 0023ced..fd1ce9b 100644
--- a/gcc48-__cxa_atexit.patch
+++ b/gcc48-__cxa_atexit.patch
@@ -105,50 +105,3 @@
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$enable_sjlj_exceptions = xyes; then
tmake_eh_file="i386/t-sjlj-eh"
---- origsrc/gcc-4.8.3/libstdc++-v3/libsupc++/atexit_thread.cc 2013-07-27 21:33:01.000000000 -0500
-+++ src/gcc-4.8.3/libstdc++-v3/libsupc++/atexit_thread.cc 2014-08-07 11:02:26.614465800 -0500
-@@ -25,6 +25,10 @@
- #include <cstdlib>
- #include <new>
- #include "bits/gthr.h"
-+#if defined(_WIN32) || defined(__CYGWIN__)
-+#define WIN32_LEAN_AND_MEAN
-+#include <windows.h>
-+#endif
-
- #if HAVE___CXA_THREAD_ATEXIT_IMPL
-
-@@ -47,6 +51,9 @@ namespace {
- void (*destructor)(void *);
- void *object;
- elt *next;
-+#if defined(_WIN32) || defined(__CYGWIN__)
-+ HMODULE dll;
-+#endif
- };
-
- // Keep a per-thread list of cleanups in gthread_key storage.
-@@ -62,6 +69,10 @@ namespace {
- {
- elt *old_e = e;
- e->destructor (e->object);
-+#if defined(_WIN32) || defined(__CYGWIN__)
-+ if (e->dll)
-+ FreeLibrary (e->dll);
-+#endif
- e = e->next;
- delete (old_e);
- }
-@@ -133,6 +144,12 @@ __cxxabiv1::__cxa_thread_atexit (void (*
- new_elt->destructor = dtor;
- new_elt->object = obj;
- new_elt->next = first;
-+#if defined(_WIN32) || defined(__CYGWIN__)
-+ /* Increment DLL count. This blocks dlclose from unloading the DLL
-+ before the thread-local dtors have been called. */
-+ GetModuleHandleExW (GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
-+ (LPCWSTR) dtor, &new_elt->dll);
-+#endif
-
- if (__gthread_active_p ())
- __gthread_setspecific (key, new_elt);
diff --git a/gcc48-libstdc-atexit_thread.patch b/gcc48-libstdc-atexit_thread.patch
new file mode 100644
index 0000000..1ae7e09
--- /dev/null
+++ b/gcc48-libstdc-atexit_thread.patch
@@ -0,0 +1,83 @@
+Index: libstdc++-v3/config/os/mingw32-w64/os_defines.h
+===================================================================
+--- libstdc++-v3/config/os/mingw32-w64/os_defines.h (revision 213759)
++++ libstdc++-v3/config/os/mingw32-w64/os_defines.h (working copy)
+@@ -78,4 +78,9 @@
+ #define _GLIBCXX_LLP64 1
+ #endif
+
++// Enable use of GetModuleHandleEx (requires Windows XP/2003) in
++// __cxa_thread_atexit to prevent modules from being unloaded before
++// their dtors are called
++#define _GLIBCXX_THREAD_ATEXIT_WIN32 1
++
+ #endif
+Index: libstdc++-v3/config/os/newlib/os_defines.h
+===================================================================
+--- libstdc++-v3/config/os/newlib/os_defines.h (revision 213759)
++++ libstdc++-v3/config/os/newlib/os_defines.h (working copy)
+@@ -47,6 +47,12 @@
+
+ // See libstdc++/20806.
+ #define _GLIBCXX_HAVE_DOS_BASED_FILESYSTEM 1
++
++// Enable use of GetModuleHandleEx (requires Windows XP/2003) in
++// __cxa_thread_atexit to prevent modules from being unloaded before
++// their dtors are called
++#define _GLIBCXX_THREAD_ATEXIT_WIN32 1
++
+ #endif
+
+ #endif
+Index: libstdc++-v3/libsupc++/atexit_thread.cc
+===================================================================
+--- libstdc++-v3/libsupc++/atexit_thread.cc (revision 213759)
++++ libstdc++-v3/libsupc++/atexit_thread.cc (working copy)
+@@ -25,6 +25,10 @@
+ #include <cstdlib>
+ #include <new>
+ #include "bits/gthr.h"
++#ifdef _GLIBCXX_THREAD_ATEXIT_WIN32
++#define WIN32_LEAN_AND_MEAN
++#include <windows.h>
++#endif
+
+ #if HAVE___CXA_THREAD_ATEXIT_IMPL
+
+@@ -47,6 +51,9 @@
+ void (*destructor)(void *);
+ void *object;
+ elt *next;
++#ifdef _GLIBCXX_THREAD_ATEXIT_WIN32
++ HMODULE dll;
++#endif
+ };
+
+ // Keep a per-thread list of cleanups in gthread_key storage.
+@@ -62,6 +69,11 @@
+ {
+ elt *old_e = e;
+ e->destructor (e->object);
++#ifdef _GLIBCXX_THREAD_ATEXIT_WIN32
++ /* Decrement DLL count */
++ if (e->dll)
++ FreeLibrary (e->dll);
++#endif
+ e = e->next;
+ delete (old_e);
+ }
+@@ -133,6 +145,14 @@
+ new_elt->destructor = dtor;
+ new_elt->object = obj;
+ new_elt->next = first;
++#ifdef _GLIBCXX_THREAD_ATEXIT_WIN32
++ /* Store the DLL address for a later call to FreeLibrary in new_elt and
++ increment DLL load count. This blocks the unloading of the DLL
++ before the thread-local dtors have been called. This does NOT help
++ if FreeLibrary/dlclose is called in excess. */
++ GetModuleHandleExW (GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
++ (LPCWSTR) dtor, &new_elt->dll);
++#endif
+
+ if (__gthread_active_p ())
+ __gthread_setspecific (key, new_elt);