This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch ld/dlltool]: Allow empty LIBRARY statement in .def file
- From: Christopher Faylor <cgf-use-the-mailinglist-please at sourceware dot org>
- To: Kai Tietz <ktietz70 at googlemail dot com>, Nick Clifton <nickc at redhat dot com>, Binutils <binutils at sourceware dot org>
- Date: Wed, 25 Jul 2012 19:05:55 -0400
- Subject: Re: [patch ld/dlltool]: Allow empty LIBRARY statement in .def file
- References: <CAEwic4YhM18R9Ns+1pRLV_a1CQXJHzKp3=7JCLSEPQ-zDsZEdw@mail.gmail.com> <CAEwic4Y7KpCKA9DhfJq_rU+D-6nrhoAMjozW68=2q_xqYTq7vQ@mail.gmail.com>
On Wed, Jul 25, 2012 at 11:13:02PM +0200, Kai Tietz wrote:
>Hi,
>
>this patch relax behavior of dlltool and ld about .def file parsing so
>that the name of LIBRARY statement is optional.
>
>ChangeLog
>
>binutils/
>2012-07-25 Kai Tietz
>
> * defparse.y (command): Call def_library only if name isn't
>NULL and not empty.
>
>ld/
>
>2012-07-25 Kai Tietz
>
> * deffilep.y (command): Call def_image_name only if name isn't
>NULL and not empty.
>
>Regression tested for x86_64-w64-mingw32, i686-w64-mingw32, and
>i686-pc-cygwin. ok for apply?
>
>Regards,
>Kai
>
>Index: defparse.y
>===================================================================
>RCS file: /cvs/src/src/binutils/defparse.y,v
>retrieving revision 1.14
>diff -u -r1.14 defparse.y
>--- defparse.y 24 Feb 2012 14:20:16 -0000 1.14
>+++ defparse.y 25 Jul 2012 20:56:31 -0000
>@@ -52,7 +52,12 @@
>
> command:
> NAME opt_name opt_base { def_name ($2, $3); }
>- | LIBRARY opt_name opt_base option_list { def_library ($2, $3); }
>+ | LIBRARY opt_name opt_base option_list
>+ {
>+ /* Ignore LIBRARY without argument, or empty name. */
>+ if ($2 && $2[0] != 0)
>+ def_library ($2, $3);
>+ }
It seems like def_library() is also making decisions based on its first
parameter. This test will short-circuit those tests. It seems like
either this should all be handled in def_library or the tests in
def_library() should be deleted.
cgf