1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
--- origsrc/gcc-4.8.3/gcc/config/i386/cygwin.h 2014-08-01 15:20:08.936969300 -0500
+++ src/gcc-4.8.3/gcc/config/i386/cygwin.h 2014-08-04 17:17:31.265803800 -0500
@@ -40,7 +40,7 @@ along with GCC; see the file COPYING3.
#define STARTFILE_SPEC "\
%{!shared: %{!mdll: crt0%O%s \
%{pg:gcrt0%O%s}}}\
- crtbegin.o%s"
+ %{shared:crtbeginS.o%s;:crtbegin.o%s}"
#undef ENDFILE_SPEC
#define ENDFILE_SPEC \
--- origsrc/gcc-4.8.3/gcc/config.gcc 2014-08-01 15:20:08.402401400 -0500
+++ src/gcc-4.8.3/gcc/config.gcc 2014-08-06 17:58:38.240552900 -0500
@@ -1452,6 +1452,7 @@ i[34567]86-*-cygwin*)
thread_file='posix'
fi
use_gcc_stdint=wrap
+ default_use_cxa_atexit=yes
;;
x86_64-*-cygwin*)
need_64bit_isa=yes
@@ -1467,6 +1468,7 @@ x86_64-*-cygwin*)
thread_file='posix'
fi
use_gcc_stdint=wrap
+ default_use_cxa_atexit=yes
;;
i[34567]86-*-mingw* | x86_64-*-mingw*)
tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h"
--- origsrc/gcc-4.8.3/libgcc/config/i386/cygming-crtbegin.c 2014-08-01 15:20:08.998477100 -0500
+++ src/gcc-4.8.3/libgcc/config/i386/cygming-crtbegin.c 2014-08-06 23:54:59.133581500 -0500
@@ -81,6 +81,24 @@ static void *__JCR_LIST__[]
= { };
#endif
+#ifdef __CYGWIN__
+/* Declare the __dso_handle variable. It should have a unique value
+ in every shared-object; in a main program its value is zero. The
+ object should in any case be protected. This means the instance
+ in one DSO or the main program is not used in another object. The
+ dynamic linker takes care of this. */
+
+#ifdef CRTSTUFFS_O
+extern void *__ImageBase;
+void *__dso_handle = &__ImageBase;
+#else
+void *__dso_handle = 0;
+#endif
+
+extern int __cxa_atexit (void (*)(void *), void *, void *);
+#endif /* __CYGWIN__ */
+
+
/* Pull in references from libgcc.a(unwind-dw2-fde.o) in the
startfile. These are referenced by a ctor and dtor in crtend.o. */
extern void __gcc_register_frame (void);
@@ -131,6 +148,17 @@ __gcc_register_frame (void)
register_class_fn (__JCR_LIST__);
}
#endif
+
+#if DEFAULT_USE_CXA_ATEXIT
+ /* If we use the __cxa_atexit method to register C++ dtors
+ at object construction, also use atexit to register eh frame
+ info cleanup. */
+#ifdef __CYGWIN__
+ __cxa_atexit(__gcc_deregister_frame, NULL, (void *)&__dso_handle);
+#else
+ atexit(__gcc_deregister_frame);
+#endif /* __CYGWIN__ */
+#endif /* DEFAULT_USE_CXA_ATEXIT */
}
void
--- origsrc/gcc-4.8.3/libgcc/config/i386/cygming-crtend.c 2013-02-04 13:06:20.000000000 -0600
+++ src/gcc-4.8.3/libgcc/config/i386/cygming-crtend.c 2014-08-06 01:27:35.568214600 -0500
@@ -70,12 +70,6 @@ static void
register_frame_ctor (void)
{
__gcc_register_frame ();
-#if DEFAULT_USE_CXA_ATEXIT
- /* If we use the __cxa_atexit method to register C++ dtors
- at object construction, also use atexit to register eh frame
- info cleanup. */
- atexit (__gcc_deregister_frame);
-#endif
}
#if !DEFAULT_USE_CXA_ATEXIT
--- origsrc/gcc-4.8.3/libgcc/config/i386/t-cygming 2011-11-02 10:23:48.000000000 -0500
+++ src/gcc-4.8.3/libgcc/config/i386/t-cygming 2014-08-04 17:15:30.836011200 -0500
@@ -8,6 +8,9 @@ CUSTOM_CRTSTUFF = yes
crtbegin.o: $(srcdir)/config/i386/cygming-crtbegin.c
$(crt_compile) -fno-omit-frame-pointer -c $<
+crtbeginS.o: $(srcdir)/config/i386/cygming-crtbegin.c
+ $(crt_compile) -fno-omit-frame-pointer -c $< -DCRTSTUFFS_O
+
# We intentionally use a implementation-reserved init priority of 0,
# so allow the warning.
crtend.o: $(srcdir)/config/i386/cygming-crtend.c
--- origsrc/gcc-4.8.3/libgcc/config.host 2014-08-01 15:20:05.717560400 -0500
+++ src/gcc-4.8.3/libgcc/config.host 2014-08-04 17:19:11.955589800 -0500
@@ -559,7 +559,7 @@ i[34567]86-*-solaris2* | x86_64-*-solari
i[4567]86-wrs-vxworks|i[4567]86-wrs-vxworksae)
;;
i[34567]86-*-cygwin*)
- extra_parts="crtbegin.o crtend.o crtfastmath.o"
+ extra_parts="crtbegin.o crtbeginS.o crtend.o crtfastmath.o"
# 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"
|