Trouble building gcc-3.4.0 cygwin->linux

Dan Kegel dank@kegel.com
Mon Jun 7 12:02:00 GMT 2004


Jim Wilson wrote:
> [See http://gcc.gnu.org/ml/gcc/2004-04/msg00906.html]
> Looking at it again, I see that there are some curious __CYGWIN__ ifdefs 
> in there which might instead be the problem.  Your cygwin-x-linux cross 
> compiler would have been compiled with a compiler that defined 
> __CYGWIN__, and thus some stuff in cp/method.c would have been enabled 
> and/or disabled that should not have been.  To fix this, put a
> #define THIS_IS_CYWGIN_REALLY
> in config/i386/cygwin.h (or maybe cygming.h?) and modify cp/method.c to 
> use that define instead of __CYGWIN__.  We need a more elegant solution 
> for gcc mainline, but one has already been written.  This is the 
> TARGET_USE_LOCAL_THUNK_ALIAS_P stuff I mentioned earler.
> 
> See PR 14808.  This contains the method.c.diff patch that broke gcc-3.4. 
>  This was an attempt to write a safer simpler patch than the one that 
> went into mainline, which can be found here
>     http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00432.html
> Unfortunately, this patch breaks cross compilers built on cygwin.

Bingo.  The following patch let my cygwin->linux build succeed.  Thanks!
- Dan

--- gcc-3.4.0/gcc/cp/method.c.old	Sun Jun  6 22:46:04 2004
+++ gcc-3.4.0/gcc/cp/method.c	Sun Jun  6 22:48:13 2004
@@ -286,7 +286,7 @@
    tree alias;
    char buf[256];

-#if defined (__CYGWIN__) || defined (__MINGW32__)
+#if defined (TARGET_IS_PE_COFF)
    if (DECL_ONE_ONLY (function))
      return function;
  #endif
@@ -404,7 +404,7 @@
    push_to_top_level ();

  #if defined (ASM_OUTPUT_DEF) \
-  && !(defined (__CYGWIN__) || defined (__MINGW32__))
+  && !defined (TARGET_IS_PE_COFF)
    if (targetm.have_named_sections)
      {
        resolve_unique_section (function, 0, flag_function_sections);
--- gcc-3.4.0/gcc/config/i386/cygwin.h.old	Sun Jun  6 22:50:41 2004
+++ gcc-3.4.0/gcc/config/i386/cygwin.h	Sun Jun  6 22:52:18 2004
@@ -22,6 +22,8 @@

  #define TARGET_VERSION fprintf (stderr, " (x86 Cygwin)");

+#define TARGET_IS_PE_COFF 1
+
  #define EXTRA_OS_CPP_BUILTINS()  /* Nothing.  */

  #undef CPP_SPEC
--- gcc-3.4.0/gcc/config/i386/cygming.h.old	Sun Jun  6 22:50:46 2004
+++ gcc-3.4.0/gcc/config/i386/cygming.h	Sun Jun  6 22:52:10 2004
@@ -27,6 +27,8 @@

  #define TARGET_EXECUTABLE_SUFFIX ".exe"

+#define TARGET_IS_PE_COFF 1
+
  #include <stdio.h>

  /* Masks for subtarget switches used by other files.  */


-- 
My technical stuff: http://kegel.com
My politics: see http://www.misleader.org for examples of why I'm for regime change



More information about the Gcc mailing list