128 lines
4.7 KiB
Diff
128 lines
4.7 KiB
Diff
diff -Naur gcc-4.9.2-orig/gcc/config/i386/cygwin.h gcc-4.9.2/gcc/config/i386/cygwin.h
|
|
--- gcc-4.9.2-orig/gcc/config/i386/cygwin.h 2014-11-04 00:34:31.420600000 +0300
|
|
+++ gcc-4.9.2/gcc/config/i386/cygwin.h 2014-11-04 00:34:33.058600000 +0300
|
|
@@ -40,7 +40,7 @@
|
|
#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 \
|
|
diff -Naur gcc-4.9.2-orig/gcc/config.gcc gcc-4.9.2/gcc/config.gcc
|
|
--- gcc-4.9.2-orig/gcc/config.gcc 2014-11-04 00:34:31.420600000 +0300
|
|
+++ gcc-4.9.2/gcc/config.gcc 2014-11-04 00:34:33.058600000 +0300
|
|
@@ -1594,6 +1594,7 @@
|
|
thread_file='posix'
|
|
fi
|
|
use_gcc_stdint=wrap
|
|
+ default_use_cxa_atexit=yes
|
|
;;
|
|
x86_64-*-cygwin*)
|
|
need_64bit_isa=yes
|
|
@@ -1902,6 +1903,7 @@
|
|
with_headers=yes
|
|
fi
|
|
use_gcc_stdint=wrap
|
|
+ default_use_cxa_atexit=yes
|
|
;;
|
|
microblaze*-linux*)
|
|
case $target in
|
|
diff -Naur gcc-4.9.2-orig/libgcc/config/i386/cygming-crtbegin.c gcc-4.9.2/libgcc/config/i386/cygming-crtbegin.c
|
|
--- gcc-4.9.2-orig/libgcc/config/i386/cygming-crtbegin.c 2014-04-30 21:09:06.000000000 +0300
|
|
+++ gcc-4.9.2/libgcc/config/i386/cygming-crtbegin.c 2014-11-04 00:34:33.089800000 +0300
|
|
@@ -110,6 +110,24 @@
|
|
= { };
|
|
#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);
|
|
@@ -155,6 +172,17 @@
|
|
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
|
|
diff -Naur gcc-4.9.2-orig/libgcc/config/i386/cygming-crtend.c gcc-4.9.2/libgcc/config/i386/cygming-crtend.c
|
|
--- gcc-4.9.2-orig/libgcc/config/i386/cygming-crtend.c 2014-01-03 01:25:22.000000000 +0300
|
|
+++ gcc-4.9.2/libgcc/config/i386/cygming-crtend.c 2014-11-04 00:34:33.089800000 +0300
|
|
@@ -70,12 +70,6 @@
|
|
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
|
|
diff -Naur gcc-4.9.2-orig/libgcc/config/i386/t-cygming gcc-4.9.2/libgcc/config/i386/t-cygming
|
|
--- gcc-4.9.2-orig/libgcc/config/i386/t-cygming 2011-11-02 18:23:48.000000000 +0300
|
|
+++ gcc-4.9.2/libgcc/config/i386/t-cygming 2014-11-04 00:34:33.089800000 +0300
|
|
@@ -8,6 +8,9 @@
|
|
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
|
|
diff -Naur gcc-4.9.2-orig/libgcc/config.host gcc-4.9.2/libgcc/config.host
|
|
--- gcc-4.9.2-orig/libgcc/config.host 2014-11-03 23:44:00.902200000 +0300
|
|
+++ gcc-4.9.2/libgcc/config.host 2014-11-04 00:34:33.105400000 +0300
|
|
@@ -603,7 +603,7 @@
|
|
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"
|
|
@@ -619,7 +619,7 @@
|
|
tmake_file="${tmake_file} ${tmake_eh_file} ${tmake_dlldir_file} i386/t-slibgcc-cygming i386/t-cygming i386/t-cygwin i386/t-crtfm i386/t-chkstk t-dfprules"
|
|
;;
|
|
x86_64-*-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"
|