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]

Re: patch ping: simplify make_decl_rtl

Danny Smith wrote:

Well, it does change handling of dllexport/dllimport override semantics on
mingw and
cygwin.  In particular,  testsuite/g++.dg/ext/dllimport-2.C no longer emits
the warnings
that were emitted by winnt.c::i386_pe_encode_section_info.  Those warnings
do help to
catch dllimport/dllexport ambiguities in user code -- mainly where a symbol
is declared as
dllimport, then used, then defined.

There is actually a follow-up winnt.c patch: The make_decl_rtl patch was just to simplify the problem, but it also needs a patch to winnt.c. This is attached; could you try if the regression remains?

I think the problem Per reported earlier with stdcall attributes could be
fixed  by simply
 making the stdcall/fastcall handling in i386_pe_encode_section_info
conditional on
 the argument 'first'..

That by itself is not enough, but in some combination with the attached patch it might work.

I missed teh significance of the 'first' parameter, probably because
the various targets on't handle it consistently.  (Mostly, they do
nothing when 'first' is true; the targets that don't test 'first'
probably should.)

If my patch is accepted, then 'first' will always be true, so a logical
follow-up patch woudl be to remove that parameter.
	--Per Bothner
--- /home/bothner/GNU/gcc.head-unmodified/gcc/config/i386/winnt.c	2004-06-03 12:33:07.000000000 -0700
+++ ./winnt.c	2004-06-08 17:54:39.000000000 -0700
@@ -490,14 +490,11 @@ 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",
-        XEXP (DECL_RTL (decl), 0) =
-	  gen_rtx_SYMBOL_REF (Pmode, gen_fastcall_suffix (decl));
+      tree type_attributes = TYPE_ATTRIBUTES (TREE_TYPE (decl));
+      if (lookup_attribute ("stdcall", type_attributes))
+	XSTR (XEXP (rtl, 0), 0) = gen_stdcall_suffix (decl);
+      else if (lookup_attribute ("fastcall", type_attributes))
+	XSTR (XEXP (rtl, 0), 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]