* [Patch/pe-i386]: Revert and fix ld/deffilep.y patch for names with '.' separators
@ 2003-03-13 8:31 Danny Smith
2003-03-13 8:35 ` Christopher Faylor
0 siblings, 1 reply; 2+ messages in thread
From: Danny Smith @ 2003-03-13 8:31 UTC (permalink / raw)
To: binutils; +Cc: Luke Dunstan, Christopher Faylor
Hi the patch I checked in yesterday was wrong. Although it is okay for
the most common uses of ld to create a dll, it fails when using an
IMPORT section. The function def_import expects the dot-separated name
to be parsed into module.module_ext.symbol_name not imput as a single ID
Here is a testcase:
================================
;foo.def
IMPORTS
_alldiv@16 = ntoskrnl.exe._alldiv
;end foo.def
=================================
/* foo.c */
extern __stdcall long long
_alldiv (long long num, long long denom);
long long
lldiv(long long a, long long b)
{ return _alldiv (a,b);}
/* foo.c */
=================================
A dll that exports lldiv, while using the _alldiv forwarded
from ntoskrnl.exe (without an import lib) can be created by
gcc -shared -ofoo.dll foo.def foo.c
The following reverts yesterday's patch and adds new rule (dot_name) to handle
dot-separated names. The rule is recursive to allow multiple dots in
filenames (eg my.file.name,cc) which could be used by g++ in
generation of unnamed namespace names.
Thanks to Luke Dunstan for reporting the mistake and providing help with this.
A patch to fix up a related problem in def_import will be submitted
seaparately.
2003-03-13 Danny Smith <dannysmith@users.sourceforge.net>
* deffilep.y (def_lex): Revert 2003-03-12 change.
(dot_name): New id type and rule.
(expline): Use instead of ID.
(opt_equal_name): Likewise.
*** deffilep.y.orig Thu Mar 13 06:33:24 2003
--- deffilep.y Thu Mar 13 06:35:23 2003
*************** static const char *lex_parse_string_end
*** 116,122 ****
%token <number> NUMBER
%type <number> opt_base opt_ordinal
%type <number> attr attr_list opt_number exp_opt_list exp_opt
! %type <id> opt_name opt_equal_name
%%
--- 116,122 ----
%token <number> NUMBER
%type <number> opt_base opt_ordinal
%type <number> attr attr_list opt_number exp_opt_list exp_opt
! %type <id> opt_name opt_equal_name dot_name
%%
*************** expline:
*** 151,157 ****
/* The opt_comma is necessary to support both the usual
DEF file syntax as well as .drectve syntax which
mandates <expsym>,<expoptlist>. */
! ID opt_equal_name opt_ordinal opt_comma exp_opt_list
{ def_exports ($1, $2, $3, $5); }
;
exp_opt_list:
--- 151,157 ----
/* The opt_comma is necessary to support both the usual
DEF file syntax as well as .drectve syntax which
mandates <expsym>,<expoptlist>. */
! dot_name opt_equal_name opt_ordinal opt_comma exp_opt_list
{ def_exports ($1, $2, $3, $5); }
;
exp_opt_list:
*************** opt_ordinal:
*** 231,237 ****
;
opt_equal_name:
! '=' ID { $$ = $2; }
| { $$ = 0; }
;
--- 231,237 ----
;
opt_equal_name:
! '=' dot_name { $$ = $2; }
| { $$ = 0; }
;
*************** opt_base: BASE '=' NUMBER { $$ = $3;}
*** 239,244 ****
--- 239,252 ----
| { $$ = 0;}
;
+ dot_name: ID { $$ = $1; }
+ | dot_name '.' ID
+ {
+ char * name = xmalloc (strlen ($1) + 1 + strlen ($3) + 1);
+ sprintf (name, "%s.%s", $1, $3);
+ $$ = name;
+ }
+ ;
%%
*************** def_lex ()
*** 1020,1026 ****
#endif
}
! while (c != EOF && (ISALNUM (c) || strchr ("$:-_?/@.", c)))
{
put_buf (c);
c = def_getc ();
--- 1028,1034 ----
#endif
}
! while (c != EOF && (ISALNUM (c) || strchr ("$:-_?/@", c)))
{
put_buf (c);
c = def_getc ();
http://mobile.yahoo.com.au - Yahoo! Mobile
- Check & compose your email via SMS on your Telstra or Vodafone mobile.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Patch/pe-i386]: Revert and fix ld/deffilep.y patch for names with '.' separators
2003-03-13 8:31 [Patch/pe-i386]: Revert and fix ld/deffilep.y patch for names with '.' separators Danny Smith
@ 2003-03-13 8:35 ` Christopher Faylor
0 siblings, 0 replies; 2+ messages in thread
From: Christopher Faylor @ 2003-03-13 8:35 UTC (permalink / raw)
To: Danny Smith; +Cc: binutils, Luke Dunstan
On Thu, Mar 13, 2003 at 07:30:17PM +1100, Danny Smith wrote:
>Hi the patch I checked in yesterday was wrong. Although it is okay for
>the most common uses of ld to create a dll, it fails when using an
>IMPORT section. The function def_import expects the dot-separated name
>to be parsed into module.module_ext.symbol_name not imput as a single ID
>
>Here is a testcase:
>================================
>;foo.def
>IMPORTS
>_alldiv@16 = ntoskrnl.exe._alldiv
>;end foo.def
>=================================
>/* foo.c */
>extern __stdcall long long
>_alldiv (long long num, long long denom);
>
>long long
>lldiv(long long a, long long b)
> { return _alldiv (a,b);}
>/* foo.c */
>=================================
>A dll that exports lldiv, while using the _alldiv forwarded
>from ntoskrnl.exe (without an import lib) can be created by
>
>gcc -shared -ofoo.dll foo.def foo.c
>
>
>The following reverts yesterday's patch and adds new rule (dot_name) to handle
>dot-separated names. The rule is recursive to allow multiple dots in
>filenames (eg my.file.name,cc) which could be used by g++ in
>generation of unnamed namespace names.
>
>Thanks to Luke Dunstan for reporting the mistake and providing help with this.
>
>A patch to fix up a related problem in def_import will be submitted
>seaparately.
Ok to commit.
Thanks,
cgf
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-03-13 8:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-13 8:31 [Patch/pe-i386]: Revert and fix ld/deffilep.y patch for names with '.' separators Danny Smith
2003-03-13 8:35 ` Christopher Faylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).