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]

Re: c++/3099: cygwin: Many g++ EH failures


Soliciting help from Cygwin folks:

The following nearly works.  If g++.brendan/eh1.C is linked against
static libgcc, it passes.  If linked against libgcc1.dll it crashes
sometime after main exits -- I presume while playing with destructors.

Most irritatingly, if I run it under the debugger, win98 crashes and
I have to push the reset button.  Thus the request for help -- perhaps
this losage doesn't show up on NT and can be debugged.  With any luck
it's just a matter of having built the dll incorrectly.


r~


PS: No change to cygwin, as intimated earlier.  I've been using 
1.3.2 freshly downloaded yesterday.


Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.602.2.30
diff -u -p -r1.602.2.30 Makefile.in
--- Makefile.in	2001/06/13 05:05:35	1.602.2.30
+++ Makefile.in	2001/06/14 00:32:07
@@ -2422,7 +2422,7 @@ distclean: clean $(INTL_DISTCLEAN) lang.
 	-rm -f testsuite/{gcc,g++}.{log,sum}
 	-rm -f intl/libintl.h libintl.h
 	-rm -f cxxmain.c splay-tree.c obstack.c alloca.c hashtab.c safe-ctype.c
-	-rm -f mklibgcc libgcc.map gccbug configargs.h
+	-rm -f mklibgcc libgcc.def gccbug configargs.h
 	-rm -f gcov.pod
 	-rm -f fixinc/Makefile
 	-rmdir cp f java objc fixinc intl po 2>/dev/null
Index: config.gcc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config.gcc,v
retrieving revision 1.27.2.9
diff -u -p -r1.27.2.9 config.gcc
--- config.gcc	2001/06/05 19:09:51	1.27.2.9
+++ config.gcc	2001/06/14 00:32:08
@@ -1470,6 +1470,7 @@ i[34567]86-*-win32)
 	if test x$enable_threads = xyes; then
 		thread_file='win32'
 	fi
+	extra_parts="crtbegin.o crtend.o"
 	exeext=.exe
 	;;
 i[34567]86-*-pe | i[34567]86-*-cygwin*)
@@ -1482,6 +1483,7 @@ i[34567]86-*-pe | i[34567]86-*-cygwin*)
 	if test x$enable_threads = xyes; then
 		thread_file='win32'
 	fi
+	extra_parts="crtbegin.o crtend.o"
 	exeext=.exe
 	;;
 i[34567]86-*-mingw32*)
@@ -1494,6 +1496,7 @@ i[34567]86-*-mingw32*)
 	if test x$enable_threads = xyes; then
 		thread_file='win32'
 	fi
+	extra_parts="crtbegin.o crtend.o"
 	exeext=.exe
 	case $machine in
 		*mingw32msv*)
@@ -1511,6 +1514,7 @@ i[34567]86-*-uwin*)
 	if test x$enable_threads = xyes; then
 		thread_file='win32'
 	fi
+	extra_parts="crtbegin.o crtend.o"
 	exeext=.exe
 	;;
 i[34567]86-*-interix*)
Index: mklibgcc.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/mklibgcc.in,v
retrieving revision 1.24.4.3
diff -u -p -r1.24.4.3 mklibgcc.in
--- mklibgcc.in	2001/05/17 01:34:29	1.24.4.3
+++ mklibgcc.in	2001/06/14 00:32:08
@@ -306,7 +306,7 @@ for ml in $MULTILIBS; do
   done
 
   if [ "$SHLIB_LINK" -a "$SHLIB_MKMAP" -a -z "$mapfile" ]; then
-    mapfile="libgcc.map"
+    mapfile="libgcc.def"
     echo ""
     echo "${mapfile}: $SHLIB_MKMAP $SHLIB_MAPFILES $libgcc_objs"
     echo '	{ $(NM_FOR_TARGET)'" $SHLIB_NM_FLAGS $libgcc_objs; echo %%; cat $SHLIB_MAPFILES; } | "'$(AWK)'" -f $SHLIB_MKMAP > "'tmp-$@'
Index: config/i386/cygwin.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/cygwin.h,v
retrieving revision 1.33.2.11
diff -u -p -r1.33.2.11 cygwin.h
--- config/i386/cygwin.h	2001/05/20 19:49:17	1.33.2.11
+++ config/i386/cygwin.h	2001/06/14 00:32:08
@@ -114,7 +114,11 @@ Boston, MA 02111-1307, USA. */
   %{shared|mdll: %{mno-cygwin:" MINGW_LIBS " mingw/dllcrt2%O%s}}\
   %{!shared: %{!mdll: %{!mno-cygwin:crt0%O%s} %{mno-cygwin:" MINGW_LIBS " mingw/crt2%O%s}\
   %{pg:gcrt0%O%s}}}\
+  crtbegin%O%s\
 "
+
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC "crtend%O%s"
 
 /* Normally, -lgcc is not needed since everything in it is in the DLL, but we
    want to allow things to be added to it when installing new versions of
Index: config/i386/t-cygwin
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/t-cygwin,v
retrieving revision 1.6
diff -u -p -r1.6 t-cygwin
--- config/i386/t-cygwin	2001/02/09 20:06:15	1.6
+++ config/i386/t-cygwin	2001/06/14 00:32:08
@@ -18,3 +18,28 @@ LIBGCC2_INCLUDES = -I$(srcdir)/../winsup
 
 winnt.o: $(srcdir)/config/i386/winnt.c $(RTL_H) $(TREE_H)
 	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/i386/winnt.c
+
+# Effectively disable the crtbegin/end rules using crtstuff.c
+T = disable
+
+# Assemble startup files.
+crtbegin.o: $(srcdir)/config/i386/cygbeg.asm $(GCC_PASSES)
+	$(GCC_FOR_TARGET) -c -o crtbegin.o -x assembler $(srcdir)/config/i386/cygbeg.asm
+crtend.o: $(srcdir)/config/i386/cygend.c $(GCC_PASSES)
+	$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -o crtend.o $(srcdir)/config/i386/cygend.c
+
+# Build a libgcc dll library
+
+SHLIB_EXT = .a
+SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
+	-o libgcc1.dll @shlib_map_file@ @multilib_flags@ @shlib_objs@ \
+	-lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 && \
+	dlltool --dllname libgcc1.dll --def @shlib_map_file@ \
+	--output-lib @shlib_base_name@.a
+
+# $(slibdir) double quoted to protect it from expansion while building
+# libgcc.mk.  We want this delayed until actual install time.
+SHLIB_INSTALL = $(INSTALL_DATA) @shlib_base_name@.a $$(slibdir)/ && \
+	$(INSTALL_DATA) libgcc1.dll $$(slibdir)/
+SHLIB_MKMAP = $(srcdir)/mkmap-dll.awk
+SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver
--- /dev/null	Wed Jun 13 17:36:24 2001
+++ mkmap-dll.awk	Wed Jun 13 14:21:16 2001
@@ -0,0 +1,80 @@
+# Generate a flat list of symbols to export.
+#	Contributed by Richard Henderson <rth@cygnus.com>
+#
+# This file is part of GNU CC.
+#
+# GNU CC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU CC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU CC; see the file COPYING.  If not, write to
+# the Free Software Foundation, 59 Temple Place - Suite 330,
+# Boston MA 02111-1307, USA.
+
+BEGIN {
+  state = "nm";
+}
+
+# Remove comment and blank lines.
+/^ *#/ || /^ *$/ {
+  next;
+}
+
+# We begin with nm input.  Collect the set of symbols that are present
+# so that we can elide undefined symbols.
+
+state == "nm" && /^%%/ {
+  state = "ver";
+  next;
+}
+
+state == "nm" && ($1 == "U" || $2 == "U") {
+  next;
+}
+
+state == "nm" && NF == 3 {
+  def[$3] = 1;
+  next;
+}
+
+state == "nm" {
+  next;
+}
+
+# Now we process a simplified variant of the Solaris symbol version
+# script.  We have one symbol per line, no semicolons, simple markers
+# for beginning and ending each section, and %inherit markers for
+# describing version inheritence.  A symbol may appear in more than
+# one symbol version, and the last seen takes effect.
+
+NF == 3 && $1 == "%inherit" {
+  next;
+}
+
+NF == 2 && $2 == "{" {
+  next;
+}
+
+$1 == "}" {
+  next;
+}
+
+{
+  export[$1] = 1;
+  next;
+}
+
+END {
+  print "LIBRARY \"libgcc1.dll\"\n"
+  print "EXPORTS"
+  for (sym in export)
+    if (def["_" sym])
+      print "\t" sym;
+}
--- /dev/null	Wed Jun 13 17:36:39 2001
+++ config/i386/cygbeg.asm	Wed Jun 13 15:21:28 2001
@@ -0,0 +1,7 @@
+.text
+	.globl ___register_frame_info
+	.globl ___deregister_frame_info
+
+.section	.eh_frame,"w"
+	.globl ___EH_FRAME_BEGIN__
+___EH_FRAME_BEGIN__:
--- /dev/null	Wed Jun 13 17:36:44 2001
+++ config/i386/cygend.c	Wed Jun 13 11:53:56 2001
@@ -0,0 +1,19 @@
+#include <stddef.h>
+#include "unwind-dw2-fde.h"
+
+extern char __EH_FRAME_BEGIN__[];
+static struct object obj;
+
+static int eh_frame_end __attribute__((section(".eh_frame"))) = -1;
+
+static void __attribute__((constructor))
+do_frame_setup (void)
+{
+  __register_frame_info (__EH_FRAME_BEGIN__, &obj);
+}
+
+static void __attribute__((destructor))
+do_frame_cleanup (void)
+{
+  __deregister_frame_info (__EH_FRAME_BEGIN__);
+}


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