[PATCH] version script grammar bug WRT 'extern' blocks

Phil Edwards phil@jaj.com
Fri Feb 14 22:11:00 GMT 2003


I've just run up against the grammar limitation regarding 'exter' blocks
in version scripts.  See

    http://gcc.gnu.org/ml/libstdc++/2003-02/msg00234.html

for an explanation; basically, there can only be one extern block, and it
has to be at the beginning of the version node.  There's no documentation
of this limitation, and certainly the error messages that result are not
helpful, and so I believe this limitation to be an unintended bug rather
than a design choice.

Here's the simple fix.  This lets me do the "second attempt" scheme from
my email above, and it passes the testsuite with these results:


                    === ld Summary ===

    # of expected passes            145
    # of expected failures          13
    /home/pme/build/build-2003-02-14/ld/ld-new 20030211

I don't have write access to the src repo, however.


2003-02-14  Phil Edwards  <pme@gcc.gnu.org>

	* ldgram.y (vers_defns):  Also recurse with 'EXTERN NAME' patterns.


Index: ldgram.y
===================================================================
RCS file: /home/pme/Repositories/srctree/src/ld/ldgram.y,v
retrieving revision 1.23
diff -u -3 -p -r1.23 ldgram.y
--- ldgram.y	30 Nov 2002 08:39:45 -0000	1.23
+++ ldgram.y	14 Feb 2003 21:51:08 -0000
@@ -1130,6 +1130,16 @@ vers_defns:
 		{
 		  $$ = lang_new_vers_pattern ($1, $3, ldgram_vers_current_lang);
 		}
+	|	vers_defns ';' EXTERN NAME '{'
+			{
+			  $<name>$ = ldgram_vers_current_lang;
+			  ldgram_vers_current_lang = $4;
+			}
+		vers_defns '}'
+			{
+			  $$ = $7;
+			  ldgram_vers_current_lang = $<name>6;
+			}
 	|	EXTERN NAME '{'
 			{
 			  $<name>$ = ldgram_vers_current_lang;



More information about the Binutils mailing list