This is the mail archive of the 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]
Other format: [Raw text]

PATCH to fix mingw bootstrap failure

Mohan Embar's scripts for build a GNU/Linux-to-MinGW cross-GCJ
stopped working after the ssa merge.  One problem I've reported
is that libmudflag won't build; another problem is that various
static functions in libjava/ is "optimized out" under -O2.

The problem is that i386_pe_encode_section_info loses the
SYMBOL_REF_DECL information when it creates a new SYMBOL_REF
for the modified label.  The attached patch is one possible fix.

An alternative solution is to defer setting SYMBOL_REF_DECL
in make_decl_rtl until after the targetm.encode_section_info
call.  This has the advantage that it might fix other broken
targets, but it appears a bit more complicated.  For example
it would have to deal with (mem (mem (symbol ...))) rtx's
created for dll indirection.

I notice other targets (rs6000, arm, pa, possibly others)
instead modify the SYMBOL_REF in place, smashing in a new name.

That may be a better solution.  If that is the recommended
approach (which seems plausible), I'll try that instead.
	--Per Bothner

2004-05-29  Per Bothner  <>

	* config/i386/winnt.c (i386_pe_encode_section_info):

Index: config/i386/winnt.c
RCS file: /cvs/gcc/gcc/gcc/config/i386/winnt.c,v
retrieving revision 1.65
diff -u -r1.65 winnt.c
--- config/i386/winnt.c	30 Apr 2004 22:26:48 -0000	1.65
+++ config/i386/winnt.c	29 May 2004 23:29:25 -0000
@@ -490,14 +490,22 @@
   if (TREE_CODE (decl) == FUNCTION_DECL)
+      const char *suffix;
       if (lookup_attribute ("stdcall",
 			    TYPE_ATTRIBUTES (TREE_TYPE (decl))))
-        XEXP (DECL_RTL (decl), 0) =
-	  gen_rtx_SYMBOL_REF (Pmode, gen_stdcall_suffix (decl));
+	suffix = gen_stdcall_suffix (decl);
       else if (lookup_attribute ("fastcall",
-        XEXP (DECL_RTL (decl), 0) =
-	  gen_rtx_SYMBOL_REF (Pmode, gen_fastcall_suffix (decl));
+	suffix = gen_fastcall_suffix (decl);
+      else
+	suffix = NULL;
+      if (suffix != NULL)
+	{
+	  rtx newrtl = gen_rtx_SYMBOL_REF (Pmode, suffix);
+	  rtx oldrtl = XEXP (rtl, 0);
+	  SYMBOL_REF_DECL (newrtl) = SYMBOL_REF_DECL (oldrtl);
+	  XEXP (rtl, 0) = newrtl;
+	}
   /* Mark the decl so we can tell from the rtl whether the object is

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