This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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 ld/binutils]: Fix PR/13710 for supporting broken user .def-file generation


Ok, here is revised version for this patch:

ChangeLog binutils/

2012-02-23  Kai Tietz  <ktietz@redhat.com>

        PR binutils/13710
        * defparse.y (keyword_as_name): Disable LIBRARY
        keyword.
	* doc/binutils.texi: Document LIBRARY exception.

ChangeLog ld/

2012-02-23  Kai Tietz  <ktietz@redhat.com>

        PR binutils/13710
        * deffilep.y (keyword_as_name): Disable LIBRARY
        keyword.

Regards,
Kai

Index: binutils/defparse.y
===================================================================
RCS file: /cvs/src/src/binutils/defparse.y,v
retrieving revision 1.13
diff -u -p -r1.13 defparse.y
--- binutils/defparse.y	11 Feb 2012 20:02:02 -0000	1.13
+++ binutils/defparse.y	23 Feb 2012 17:53:13 -0000
@@ -153,7 +153,10 @@ opt_PRIVATE:
 	;

 keyword_as_name: NAME { $$ = "NAME"; }
-	| LIBRARY { $$ = "LIBRARY"; }
+/*  Disabled LIBRARY keyword for a quirk in libtool. It places LIBRARY
+    command after EXPORTS list, which is illegal by specification.
+    See PR binutils/13710
+	| LIBRARY { $$ = "LIBRARY"; } */
 	| DESCRIPTION { $$ = "DESCRIPTION"; }
 	| STACKSIZE { $$ = "STACKSIZE"; }
 	| HEAPSIZE { $$ = "HEAPSIZE"; }
Index: binutils/doc/binutils.texi
===================================================================
RCS file: /cvs/src/src/binutils/doc/binutils.texi,v
retrieving revision 1.186
diff -u -p -r1.186 binutils.texi
--- binutils/doc/binutils.texi	1 Feb 2012 16:49:26 -0000	1.186
+++ binutils/doc/binutils.texi	23 Feb 2012 17:53:14 -0000
@@ -3987,6 +3987,9 @@ The result is going to be named @var{nam

 @item @code{LIBRARY} @var{name} @code{[ ,} @var{base} @code{]}
 The result is going to be named @var{name}@code{.dll}.
+Note: If you want to use LIBRARY as name then you need to quote.  Otherwise
+this will fail due a necessary hack for libtool (see PR binutils/13710 for more
+details).

 @item @code{EXPORTS ( ( (} @var{name1} @code{[ = } @var{name2}
@code{] ) | ( } @var{name1} @code{=} @var{module-name} @code{.}
@var{external-name} @code{) ) [ == } @var{its_name} @code{]}
 @item @code{[} @var{integer} @code{] [ NONAME ] [ CONSTANT ] [ DATA ]
[ PRIVATE ] ) *}
@@ -3995,6 +3998,9 @@ ordinal number @var{integer}, or declare
 (forward) of the function @var{external-name} in the DLL.
 If @var{its_name} is specified, this name is used as string in export table.
 @var{module-name}.
+Note: The @code{EXPORTS} has to be the last command in .def file, as keywords
+are treated - beside @code{LIBRARY} - as simple name-identifiers.
+If you want to use LIBRARY as name then you need to quote it.

 @item @code{IMPORTS ( (} @var{internal-name} @code{=}
@var{module-name} @code{.} @var{integer} @code{) | [}
@var{internal-name} @code{= ]} @var{module-name} @code{.}
@var{external-name} @code{) [ == ) @var{its_name} @code{]} *}
 Declares that @var{external-name} or the exported function whose
@@ -4003,6 +4009,9 @@ ordinal number is @var{integer} is to be
 the name that the imported function will be referred to in the body of
 the DLL.
 If @var{its_name} is specified, this name is used as string in import table.
+Note: The @code{IMPORTS} has to be the last command in .def file, as keywords
+are treated - beside @code{LIBRARY} - as simple name-identifiers.
+If you want to use LIBRARY as name then you need to quote it.

 @item @code{DESCRIPTION} @var{string}
 Puts @var{string} into the output @file{.exp} file in the
Index: ld/deffilep.y
===================================================================
RCS file: /cvs/src/src/ld/deffilep.y,v
retrieving revision 1.39
diff -u -p -r1.39 deffilep.y
--- ld/deffilep.y	19 Feb 2012 21:18:08 -0000	1.39
+++ ld/deffilep.y	23 Feb 2012 17:53:14 -0000
@@ -249,7 +249,12 @@ keyword_as_name: BASE { $$ = "BASE"; }
 	 | EXPORTS { $$ = "EXPORTS"; }
 	 | HEAPSIZE { $$ = "HEAPSIZE"; }
 	 | IMPORTS { $$ = "IMPORTS"; }
-	 | LIBRARY { $$ = "LIBRARY"; }
+/* Disable LIBRARY keyword as valid symbol-name.  This is necessary
+   for libtool, which places this command after EXPORTS command.
+   This behavior is illegal by specification, but sadly required by
+   by compatibility reasons.
+   See PR binutils/13710
+	 | LIBRARY { $$ = "LIBRARY"; } */
 	 | NAME { $$ = "NAME"; }
 	 | NONAMEU { $$ = "NONAME"; }
 	 | NONAMEL { $$ = "noname"; }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]