gcc 2.8.0 or RegOpenKeyExA

Mumit Khan khan@xraylith.wisc.edu
Sat Jan 24 22:41:00 GMT 1998

"Kris Thielemans" <kris@wren.rpms.ac.uk> writes:
> Hi,
> I'm trying to compile the standard distribution of gcc 2.8.0 under cygwin
> b18. Maybe someone could tell me if this is a sensible thing to do, or
> should I wait for b19 ? I need 2.8.0 for C++ reasons.

GCC 2.8.0 has serious problems with C++ templates (and rtti) on Win32.
Most of the patches to fix these didn't make into the gcc-2.8.0 release,
but are fixed in my binary release for egcs-1.00 (locally patched). The
problem is that the C++ front end of gcc-2.8.0 doesn't put explicitly 
instantiated templates in named sections, and you end up with multiple 
definitions for both the template body and also RTTI info.

If you're willing to deal with egcs snapshots, let me know and I'll email
the patches I'm using locally (most tested quite thorougly). I believe that 
most of these are now in the latest egcs snapshot, so you should be able
just pick the last one and go from there.

(My) Rule of thumb: If you're interested in just C, stick with GCC 2.8.0; 
for anything else, go with EGCS at least on Win32.

You could scan the egcs-bugs mailing list archives and pick out my patches
and apply those to GCC 2.8.0 as well. No guarantees however.

> In the process, I have a problem linking cccp: "undefined reference to
> RegOpenKeyExA@20" (and another registry function). Should I link with some
> extra windows library ?

Try the following patch that'll fix this particular problem:

To: egcs-bugs@cygnus.com
Subject: (971215) patch for i386-cygwin32
Date: Sun, 21 Dec 1997 01:12:08 -0600
From: Mumit Khan <khan@cygnus.com>

The following patch against egcs-971215 fixes the support for
i386-cygwin32. These changes are due to gcc-2.8.0 merge. These apply
to gcc-2.8.0 as well.

I personally don't like the changes to i386/xm-cygwin32, but I don't see 
any other way out right now.

I'll post all the changes to enable i386-mingw32 within the next few days
after I do the final testing (esp to make sure that other targets don't
feel the changes).

Thu Dec 18 18:40:17 1997  Mumit Khan <khan@xraylith.wisc.edu>
	Refine support for cygwin32 target.

	* i386/cygwin32.h (NO_IMPLICIT_EXTERN_C): Don't assume anything
	about system headers.
	(LIB_SPEC): Add -ladvapi32 -lshell32 to be consistent with mingw32
	and also to resolve symbols in prefix.c.

	* i386/xm-cygwin32.h (HAVE_BCOPY): Define. This avoids a conflict
	between gansidecl.h and newlib's _ansi.h when building libgcc2.a,
	when the definitions in auto-config.h is not visible.
	(HAVE_BZERO): Likewise.
	(HAVE_BCMP): Likewise.
	(HAVE_RINDEX): Likewise.
	(HAVE_INDEX): Likewise.

Index: egcs/gcc/config/i386/cygwin32.h
diff -c egcs/gcc/config/i386/cygwin32.h: egcs/gcc/config/i386/cygwin32.h:1.2
*** egcs/gcc/config/i386/cygwin32.h:	Sat Dec 20 12:10:36 1997
--- egcs/gcc/config/i386/cygwin32.h	Sat Dec 20 16:34:20 1997
*** 51,57 ****
     ld, but that doesn't work just yet.  */
  #undef LIB_SPEC
! #define LIB_SPEC "-lcygwin %{mwindows:-luser32 -lgdi32 -lcomdlg32} -lkernel32"
  #define LINK_SPEC "%{mwindows:--subsystem windows}"
--- 51,58 ----
     ld, but that doesn't work just yet.  */
  #undef LIB_SPEC
! #define LIB_SPEC "-lcygwin %{mwindows:-luser32 -lgdi32 -lcomdlg32} -lkernel32 \
!   -ladvapi32 -lshell32"
  #define LINK_SPEC "%{mwindows:--subsystem windows}"
*** 209,211 ****
--- 210,214 ----
  /* DWARF2 Unwinding doesn't work with exception handling yet. */
  #define DWARF2_UNWIND_INFO 0
+ /* Don't assume anything about the header files. */
Index: egcs/gcc/config/i386/xm-cygwin32.h
diff -c egcs/gcc/config/i386/xm-cygwin32.h: egcs/gcc/config/i386/xm-cygwin32.h:1.2
*** egcs/gcc/config/i386/xm-cygwin32.h:	Sat Dec 20 12:10:38 1997
--- egcs/gcc/config/i386/xm-cygwin32.h	Sun Dec 21 00:50:35 1997
*** 22,27 ****
--- 22,32 ----
  #define NO_STAB_H
  #define EXECUTABLE_SUFFIX ".exe"
  #define NO_SYS_SIGLIST 1
+ #define HAVE_BCOPY 1
+ #define HAVE_BZERO 1
+ #define HAVE_BCMP 1
+ #define HAVE_RINDEX 1
+ #define HAVE_INDEX 1
  /* Even though we support "/", allow "\" since everybody tests both.  */
  #define DIR_SEPARATOR '\\'

Mumit -- khan@xraylith.wisc.edu
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

More information about the Cygwin mailing list