From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10256 invoked by alias); 27 Nov 2002 19:52:59 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 10240 invoked from network); 27 Nov 2002 19:52:57 -0000 Received: from unknown (HELO epita.fr) (163.5.255.10) by sources.redhat.com with SMTP; 27 Nov 2002 19:52:57 -0000 Received: from goa.lrde.epita.fr (mail@goa.lrde.epita.fr [10.223.13.2]) by epita.fr id gARJqr608001 for EPITA Paris France Wed, 27 Nov 2002 20:52:53 +0100 (MET) Received: from babylon.lrde.epita.fr ([10.223.13.55] ident=mail) by goa.lrde.epita.fr with esmtp (Exim 3.35 #1 (Debian)) id 18H8F3-0001mT-00 for ; Wed, 27 Nov 2002 20:53:01 +0100 Received: from news by babylon.lrde.epita.fr with local (Exim 3.36 #1 (Debian)) id 18H87r-0003jJ-00 for ; Wed, 27 Nov 2002 20:45:35 +0100 From: chorns@users.sourceforge.net (Casper Hornstrup) X-Newsgroups: epita.lrde.list.gcc.patches Subject: RE: [PATCH] Fastcall support on cygwin and mingw targets Date: Wed, 27 Nov 2002 21:15:00 -0000 Organization: EPITA / LRDE http://www.lrde.epita.fr Message-ID: <005001c2964d$7d4e3200$0300000a@csiteoffice.csite.com> References: <20021125233927.GO25134@redhat.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0051_01C29655.DF129A00" X-Complaints-To: usenet@lrde.epita.fr X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 To: gcc-patches@gcc.gnu.org X-SW-Source: 2002-11/txt/msg01833.txt.bz2 Message-ID: <20021127211500.E2bUvwm20vnueuJ8YMQdG9oFl4ulCQuFnCZlxw1Pz0k@z> This is a multi-part message in MIME format. ------=_NextPart_000_0051_01C29655.DF129A00 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-length: 2123 > -----Original Message----- > From: Richard Henderson [mailto:rth@redhat.com] > Sent: 26. november 2002 00:39 > To: Casper Hornstrup > Cc: gcc-patches@gcc.gnu.org > Subject: Re: [PATCH] Fastcall support on cygwin and mingw targets > > > First, please avoid putting the patch into a tarball. It > just makes it harder to review. > I will do that. > On Thu, Nov 14, 2002 at 05:28:25PM +0100, Casper Hornstrup wrote: > > ! /* Output a reference to a label. Fastcall symbols are > prefixed with @, > > ! whereas symbols for functions using other calling > conventions don't > > ! have a prefix (unless they are marked dllimport or dllexport). > > ! Internally, @ is used as a prefix for symbols that are > marked dllimport > > ! or dllexport so internally the prefix + is used for > fastcall symbols. */ > > #undef ASM_OUTPUT_LABELREF > > ! #define ASM_OUTPUT_LABELREF(STREAM, NAME) \ > > (1) This is now so big it should be moved to an external function. > (2) The frobbing of @ and + is confusing. It is not *required* > that @ be used for dllimport/export. I'd prefer to first see > a patch that replaced the literal @ with a macro; then the macro > can expand to something other than @, and your life is happier. > Okay, lets take care of the dllimport/dllexport macro patch first then. I have attached a patch that does this. > > + The @code{fastcall} calling convention exists in Windows > for Intel > > + processors only. > > This is false. It exists on all ia32 targets. The name > mangling only happens on Windows, but that is not required > for the calling convention to be in effect. I will remove that sentence in the next version of the patch. 2002-11-27 Casper S. Hornstrup * config/i386/i386.h (DLL_IMPORT_EXPORT_PREFIX): Define. * config/i386/winnt.c (i386_pe_dllexport_name_p): Use DLL_IMPORT_EXPORT_PREFIX, not '@'. (i386_pe_dllimport_name_p): Likewise. (i386_pe_mark_dllexport): Likewise. (i386_pe_mark_dllimport): Likewise. (i386_pe_encode_section_info): Likewise. (i386_pe_strip_name_encoding): Likewise. ------=_NextPart_000_0051_01C29655.DF129A00 Content-Type: application/octet-stream; name="dll.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="dll.diff" Content-length: 5384 Index: config/i386/i386.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvsroot/gcc/gcc/gcc/config/i386/i386.h,v=0A= retrieving revision 1.307=0A= diff -c -3 -p -r1.307 i386.h=0A= *** config/i386/i386.h 21 Nov 2002 22:54:20 -0000 1.307=0A= --- config/i386/i386.h 27 Nov 2002 19:23:34 -0000=0A= *************** enum fp_cw_mode {FP_CW_STORED, FP_CW_UNI=0A= *** 3444,3449 ****=0A= --- 3444,3452 ----=0A= =20=20=0A= =0C=0A= #define MACHINE_DEPENDENT_REORG(X) x86_machine_dependent_reorg(X)=0A= +=20=0A= + #define DLL_IMPORT_EXPORT_PREFIX '@'=0A= +=20=0A= /*=0A= Local variables:=0A= version-control: t=0A= Index: config/i386/winnt.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvsroot/gcc/gcc/gcc/config/i386/winnt.c,v=0A= retrieving revision 1.36=0A= diff -c -3 -p -r1.36 winnt.c=0A= *** config/i386/winnt.c 19 Sep 2002 13:51:23 -0000 1.36=0A= --- config/i386/winnt.c 27 Nov 2002 19:23:34 -0000=0A= *************** int=0A= *** 199,205 ****=0A= i386_pe_dllexport_name_p (symbol)=0A= const char *symbol;=0A= {=0A= ! return symbol[0] =3D=3D '@' && symbol[1] =3D=3D 'e' && symbol[2] =3D=3D= '.';=0A= }=0A= =20=20=0A= /* Return nonzero if SYMBOL is marked as being dllimport'd. */=0A= --- 199,206 ----=0A= i386_pe_dllexport_name_p (symbol)=0A= const char *symbol;=0A= {=0A= ! return symbol[0] =3D=3D DLL_IMPORT_EXPORT_PREFIX=0A= ! && symbol[1] =3D=3D 'e' && symbol[2] =3D=3D '.';=0A= }=0A= =20=20=0A= /* Return nonzero if SYMBOL is marked as being dllimport'd. */=0A= *************** int=0A= *** 208,214 ****=0A= i386_pe_dllimport_name_p (symbol)=0A= const char *symbol;=0A= {=0A= ! return symbol[0] =3D=3D '@' && symbol[1] =3D=3D 'i' && symbol[2] =3D=3D= '.';=0A= }=0A= =20=20=0A= /* Mark a DECL as being dllexport'd.=0A= --- 209,216 ----=0A= i386_pe_dllimport_name_p (symbol)=0A= const char *symbol;=0A= {=0A= ! return symbol[0] =3D=3D DLL_IMPORT_EXPORT_PREFIX=0A= ! && symbol[1] =3D=3D 'i' && symbol[2] =3D=3D '.';=0A= }=0A= =20=20=0A= /* Mark a DECL as being dllexport'd.=0A= *************** i386_pe_mark_dllexport (decl)=0A= *** 237,243 ****=0A= return; /* already done */=0A= =20=20=0A= newname =3D alloca (strlen (oldname) + 4);=0A= ! sprintf (newname, "@e.%s", oldname);=0A= =20=20=0A= /* We pass newname through get_identifier to ensure it has a unique=0A= address. RTL processing can sometimes peek inside the symbol ref=0A= --- 239,245 ----=0A= return; /* already done */=0A= =20=20=0A= newname =3D alloca (strlen (oldname) + 4);=0A= ! sprintf (newname, "%ce.%s", DLL_IMPORT_EXPORT_PREFIX, oldname);=0A= =20=20=0A= /* We pass newname through get_identifier to ensure it has a unique=0A= address. RTL processing can sometimes peek inside the symbol ref=0A= *************** i386_pe_mark_dllimport (decl)=0A= *** 312,318 ****=0A= }=0A= =20=20=0A= newname =3D alloca (strlen (oldname) + 11);=0A= ! sprintf (newname, "@i._imp__%s", oldname);=0A= =20=20=0A= /* We pass newname through get_identifier to ensure it has a unique=0A= address. RTL processing can sometimes peek inside the symbol ref=0A= --- 314,320 ----=0A= }=0A= =20=20=0A= newname =3D alloca (strlen (oldname) + 11);=0A= ! sprintf (newname, "%ci._imp__%s", DLL_IMPORT_EXPORT_PREFIX, oldname);= =0A= =20=20=0A= /* We pass newname through get_identifier to ensure it has a unique=0A= address. RTL processing can sometimes peek inside the symbol ref=0A= *************** i386_pe_encode_section_info (decl, first=0A= *** 399,406 ****=0A= i386_pe_mark_dllimport (decl);=0A= /* It might be that DECL has already been marked as dllimport, but a=0A= subsequent definition nullified that. The attribute is gone but=0A= ! DECL_RTL still has @i._imp__foo. We need to remove that. Ditto=0A= ! for the DECL_NON_ADDR_CONST_P flag. */=0A= else if ((TREE_CODE (decl) =3D=3D FUNCTION_DECL=0A= || TREE_CODE (decl) =3D=3D VAR_DECL)=0A= && DECL_RTL (decl) !=3D NULL_RTX=0A= --- 401,408 ----=0A= i386_pe_mark_dllimport (decl);=0A= /* It might be that DECL has already been marked as dllimport, but a=0A= subsequent definition nullified that. The attribute is gone but=0A= ! DECL_RTL still has (DLL_IMPORT_EXPORT_PREFIX)i._imp__foo. We need= =0A= ! to remove that. Ditto for the DECL_NON_ADDR_CONST_P flag. */=0A= else if ((TREE_CODE (decl) =3D=3D FUNCTION_DECL=0A= || TREE_CODE (decl) =3D=3D VAR_DECL)=0A= && DECL_RTL (decl) !=3D NULL_RTX=0A= *************** const char *=0A= *** 428,434 ****=0A= i386_pe_strip_name_encoding (str)=0A= const char *str;=0A= {=0A= ! if (*str =3D=3D '@')=0A= str +=3D 3;=0A= if (*str =3D=3D '*')=0A= str +=3D 1;=0A= --- 430,436 ----=0A= i386_pe_strip_name_encoding (str)=0A= const char *str;=0A= {=0A= ! if (*str =3D=3D DLL_IMPORT_EXPORT_PREFIX)=0A= str +=3D 3;=0A= if (*str =3D=3D '*')=0A= str +=3D 1;=0A= ------=_NextPart_000_0051_01C29655.DF129A00--