This is the mail archive of the binutils@sources.redhat.com 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]

[PATCH] Re: Symbol versioning in C++ (two ld bugs)



This has been bootstrapped nightly for the last couple of nights on
i686-linux.  The change to the manual was tested with "make info" and
reading the info nodes.

Three changes:

1)  rename lang_new_vers_regex to lang_new_vers_pattern as discussed,

2)  allow additional characters in symbol names for version scripts,
    so that actual globbing patterns can be used,

3)  document that the wildcard names used are globs, not regexps or
    things that just permit a trailing '*', etc.

I do not have write perms to the src repo; someone else will have to commit
this if it's approved.



2002-02-13  Phil Edwards  <pme@gcc.gnu.org>

	* ld.texinfo (VERSION scripts):  Symbol names are globbing patterns.
	* ldgram.y (lang_new_vers_regex):  Rename to lang_new_vers_pattern;
	the pattern in question is not a regexp.
	* ldlang.c:  Likewise.
	* ldlang.h:  Likewise.
	* ldlex.l (V_IDENTIFIER):  Allow '[', ']', '-', '!', and '^' also.


Index: ld.texinfo
===================================================================
RCS file: /cvs/src/src/ld/ld.texinfo,v
retrieving revision 1.62
diff -u -3 -p -r1.62 ld.texinfo
--- ld.texinfo	2002/02/12 14:50:06	1.62
+++ ld.texinfo	2002/02/13 19:57:41
@@ -1,7 +1,7 @@
 \input texinfo
 @setfilename ld.info
 @c Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-@c 2001 Free Software Foundation, Inc.
+@c 2001, 2002 Free Software Foundation, Inc.
 @syncodeindex ky cp
 @include configdoc.texi
 @c (configdoc.texi is generated by the Makefile)
@@ -58,7 +58,7 @@ END-INFO-DIR-ENTRY
 This file documents the @sc{gnu} linker LD version @value{VERSION}.
 
 Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000,
-2001 Free Software Foundation, Inc.
+2001, 2002 Free Software Foundation, Inc.
 
 @ignore
 
@@ -3672,7 +3672,10 @@ This example version script defines thre
 version node defined is @samp{VERS_1.1}; it has no other dependencies.
 The script binds the symbol @samp{foo1} to @samp{VERS_1.1}.  It reduces
 a number of symbols to local scope so that they are not visible outside
-of the shared library.
+of the shared library; this is done using wildcard patterns, so that any
+symbol whose name begins with @samp{old}, @samp{original}, or @samp{new}
+is matched.  The wildcard patterns available are the same as those used
+in the shell when matching filenames (also known as ``globbing'').
 
 Next, the version script defines node @samp{VERS_1.2}.  This node
 depends upon @samp{VERS_1.1}.  The script binds the symbol @samp{foo2}
Index: ldgram.y
===================================================================
RCS file: /cvs/src/src/ld/ldgram.y,v
retrieving revision 1.17
diff -u -3 -p -r1.17 ldgram.y
--- ldgram.y	2002/02/12 14:50:06	1.17
+++ ldgram.y	2002/02/13 19:57:41
@@ -1116,11 +1116,11 @@ vers_tag:
 vers_defns:
 		VERS_IDENTIFIER
 		{
-		  $$ = lang_new_vers_regex (NULL, $1, ldgram_vers_current_lang);
+		  $$ = lang_new_vers_pattern (NULL, $1, ldgram_vers_current_lang);
 		}
 	|	vers_defns ';' VERS_IDENTIFIER
 		{
-		  $$ = lang_new_vers_regex ($1, $3, ldgram_vers_current_lang);
+		  $$ = lang_new_vers_pattern ($1, $3, ldgram_vers_current_lang);
 		}
 	|	EXTERN NAME '{'
 			{
Index: ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.73
diff -u -3 -p -r1.73 ldlang.c
--- ldlang.c	2002/02/12 14:50:06	1.73
+++ ldlang.c	2002/02/13 19:57:41
@@ -5020,7 +5020,7 @@ lang_vers_match_lang_java (expr, sym)
 /* This is called for each variable name or match expression.  */
 
 struct bfd_elf_version_expr *
-lang_new_vers_regex (orig, new, lang)
+lang_new_vers_pattern (orig, new, lang)
      struct bfd_elf_version_expr *orig;
      const char *new;
      const char *lang;
@@ -5193,7 +5193,7 @@ lang_do_version_exports_section ()
       p = contents;
       while (p < contents + len)
 	{
-	  greg = lang_new_vers_regex (greg, p, NULL);
+	  greg = lang_new_vers_pattern (greg, p, NULL);
 	  p = strchr (p, '\0') + 1;
 	}
 
@@ -5204,7 +5204,7 @@ lang_do_version_exports_section ()
 	bfd_get_section_flags (is->the_bfd, sec) | SEC_EXCLUDE);
     }
 
-  lreg = lang_new_vers_regex (NULL, "*", NULL);
+  lreg = lang_new_vers_pattern (NULL, "*", NULL);
   lang_register_vers_node (command_line.version_exports_section,
 			   lang_new_vers_node (greg, lreg), NULL);
 }
Index: ldlang.h
===================================================================
RCS file: /cvs/src/src/ld/ldlang.h,v
retrieving revision 1.16
diff -u -3 -p -r1.16 ldlang.h
--- ldlang.h	2002/02/10 10:55:18	1.16
+++ ldlang.h	2002/02/13 19:57:41
@@ -463,7 +463,7 @@ extern void lang_leave_overlay
 
 extern struct bfd_elf_version_tree *lang_elf_version_info;
 
-extern struct bfd_elf_version_expr *lang_new_vers_regex
+extern struct bfd_elf_version_expr *lang_new_vers_pattern
   PARAMS ((struct bfd_elf_version_expr *, const char *, const char *));
 extern struct bfd_elf_version_tree *lang_new_vers_node
   PARAMS ((struct bfd_elf_version_expr *, struct bfd_elf_version_expr *));
Index: ldlex.l
===================================================================
RCS file: /cvs/src/src/ld/ldlex.l,v
retrieving revision 1.11
diff -u -3 -p -r1.11 ldlex.l
--- ldlex.l	2002/02/12 14:50:06	1.11
+++ ldlex.l	2002/02/13 19:57:41
@@ -116,7 +116,7 @@ WHITE		[ \t\n\r]+ 
 NOCFILENAMECHAR	[_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~]
 
 V_TAG [.$_a-zA-Z][._a-zA-Z0-9]*
-V_IDENTIFIER [*?.$_a-zA-Z]([*?.$_a-zA-Z0-9]|::)*
+V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^]([*?.$_a-zA-Z0-9\[\]\-\!\^]|::)*
 
 %s SCRIPT
 %s EXPRESSION


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