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]
Other format: [Raw text]

PATCH to i386_pe_encode_section_info


This patch is a more robust (I hope) update of:
http://gcc.gnu.org/ml/gcc-patches/2004-05/msg01960.html
It also replaces my make_decl_rtl patch
http://gcc.gnu.org/ml/gcc-patches/2004-06/msg00231.html

Danny, could you test this patch for regressions on MingGW
or Cygwin, since you seem to have experience testing these
platforms.  (This is without the make_decl_rtl patch,
which I'm dropping).
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/
2004-06-23  Per Bothner  <per@bothner.com>

	* config/i386/winnt.c (i386_pe_encode_section_info):  Smash rtlname's 
	XSTR in place, so we don't lose SYMBOL_REF_DECL info.

Index: config/i386/winnt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/winnt.c,v
retrieving revision 1.67
diff -u -p -r1.67 winnt.c
--- config/i386/winnt.c	9 Jun 2004 22:52:10 -0000	1.67
+++ config/i386/winnt.c	24 Jun 2004 06:28:44 -0000
@@ -490,14 +490,14 @@ i386_pe_encode_section_info (tree decl, 
 
   if (TREE_CODE (decl) == FUNCTION_DECL)
     {
-      if (lookup_attribute ("stdcall",
-			    TYPE_ATTRIBUTES (TREE_TYPE (decl))))
-        XEXP (DECL_RTL (decl), 0) =
-	  gen_rtx_SYMBOL_REF (Pmode, gen_stdcall_suffix (decl));
-      else if (lookup_attribute ("fastcall",
-				 TYPE_ATTRIBUTES (TREE_TYPE (decl))))
-        XEXP (DECL_RTL (decl), 0) =
-	  gen_rtx_SYMBOL_REF (Pmode, gen_fastcall_suffix (decl));
+      tree type_attributes = TYPE_ATTRIBUTES (TREE_TYPE (decl));
+      rtx rtlname = XEXP (rtl, 0);
+      if (GET_CODE (rtlname) == MEM)
+	rtlname = XEXP (rtlname, 0);
+      if (lookup_attribute ("stdcall", type_attributes))
+	XSTR (rtlname, 0) = gen_stdcall_suffix (decl);
+      else if (lookup_attribute ("fastcall", type_attributes))
+	XSTR (rtlname, 0) = gen_fastcall_suffix (decl);
     }
 
   /* 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]