winnt.c (i386_pe_encode_section_info): Smash rtlname's XSTR in place, so we don't...
authorPer Bothner <per@bothner.com>
Wed, 30 Jun 2004 05:04:38 +0000 (22:04 -0700)
committerPer Bothner <bothner@gcc.gnu.org>
Wed, 30 Jun 2004 05:04:38 +0000 (22:04 -0700)
* config/i386/winnt.c (i386_pe_encode_section_info):  Smash rtlname's
XSTR in place, so we don't lose SYMBOL_REF_DECL info.

From-SVN: r83893

gcc/ChangeLog
gcc/config/i386/winnt.c

index a02c1e0bfb46787b51cc83d9ef3a9c655fc84299..4be6f6b50b7f78fd7e880d669347da0bc175b237 100644 (file)
@@ -1,3 +1,8 @@
+2004-06-29  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.
+
 2004-06-29  Zack Weinberg  <zack@codesourcery.com>
 
        * config/ia64/hpux.h: Target does too support thread-local storage.
index cf80087c8705c3071004f40c708badfbe41bc686..f0b1aec08214bda9815f356cde84d5a7b4f04e78 100644 (file)
@@ -488,16 +488,16 @@ i386_pe_encode_section_info (tree decl, rtx rtl, int first)
 {
   default_encode_section_info (decl, rtl, first);
 
-  if (TREE_CODE (decl) == FUNCTION_DECL)
+  if (first && 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