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]

PATCH: add support for --dynamic-list and friends


This patch adds support for --dynamic-list, --dynamic-list-data,
--dynamic-list-cpp-new, and --dynamic-list-cpp-typeinfo.  Let me know
what you think.

craig

--cut here--

2008-11-05  Craig Silverstein  <csilvers@google.com>

	* options.cc (General_options::parse_dynamic_list): New function.
	* options.h (General_options): New flags dynamic_list,
	dynamic_list_data, dynamic_list_cpp_new, and
	dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
	(General_options::in_dynamic_list): New function.
	* script.cc (Lex::Mode): New enum DYNAMIC_LIST.
	(Lex::can_start_name): Add support for DYNAMIC_LIST mode.
	(Lex::can_continue_name): Likewise.
	(yylex): Likewise.
	(read_script_file): New parameter script_options.
	(read_dynamic_list): New function.
	(Script_options::define_dynamic_list): New function.
	(dynamic_list_keyword_parsecodes): New variable.
	(dynamic_list_keywords): New variable.
	* script.h (Script_options::define_dynamic_list): New function
	prototype.
	(read_dynamic_list): New function prototype.
	* symtab.cc (strprefix): New macro.
	(Symbol::should_add_dynsym_entry): Support dynamic_list,
	dynamic_list_data, dynamic_list_cpp_new, and
	dynamic_list_cpp_typeinfo.
	* yyscript.y (PARSING_DYNAMIC_LIST): New token.
	(dynamic_list_expr): New rule.
	(dynamic_list_nodes): Likewise.
	(dynamic_list_node): Likewise.
	* testsuite/Makefile.am (dynamic_list): New test.
	* testsuite/Makefile.in: Regenerated.
	* testsuite/dynamic_list.t: New file.
	* testsuite/dynamic_list.sh: New file.
	* testsuite/dynamic_list.stdout: New file.

Index: options.cc
===================================================================
RCS file: /cvs/src/src/gold/options.cc,v
retrieving revision 1.78
diff -u -r1.78 options.cc
--- options.cc	7 Oct 2008 23:40:21 -0000	1.78
+++ options.cc	5 Nov 2008 07:48:20 -0000
@@ -348,6 +348,14 @@
 }
 
 void
+General_options::parse_dynamic_list(const char*, const char* arg,
+                                    Command_line* cmdline)
+{
+  if (!read_dynamic_list(arg, cmdline, &this->dynamic_list_))
+    gold::gold_fatal(_("unable to parse dynamic-list script file %s"), arg);
+}
+
+void
 General_options::parse_start_group(const char*, const char*,
                                    Command_line* cmdline)
 {
Index: options.h
===================================================================
RCS file: /cvs/src/src/gold/options.h,v
retrieving revision 1.87
diff -u -r1.87 options.h
--- options.h	19 Sep 2008 22:54:57 -0000	1.87
+++ options.h	5 Nov 2008 07:48:20 -0000
@@ -620,6 +620,18 @@
               N_("Try to detect violations of the One Definition Rule"),
               NULL);
 
+  DEFINE_bool(dynamic_list_data, options::TWO_DASHES, '\0', false,
+              N_("Add data symbols to dynamic symbols"), NULL);
+
+  DEFINE_bool(dynamic_list_cpp_new, options::TWO_DASHES, '\0', false,
+              N_("Add C++ operator new/delete to dynamic symbols"), NULL);
+
+  DEFINE_bool(dynamic_list_cpp_typeinfo, options::TWO_DASHES, '\0', false,
+              N_("Add C++ typeinfo to dynamic symbols"), NULL);
+
+  DEFINE_special(dynamic_list, options::TWO_DASHES, '\0',
+                 N_("Read a list of dynamic symbols"), N_("FILE"));
+
   DEFINE_string(entry, options::TWO_DASHES, 'e', NULL,
                 N_("Set program start address"), N_("ADDRESS"));
 
@@ -933,6 +945,11 @@
   plugins() const
   { return this->plugins_; }
 
+  // True iff SYMBOL was found in the file specified by dynamic-list.
+  bool
+  in_dynamic_list(const char* symbol) const
+  { return this->dynamic_list_.version_script_info()->symbol_is_local(symbol); }
+
  private:
   // Don't copy this structure.
   General_options(const General_options&);
@@ -982,6 +999,10 @@
   bool do_demangle_;
   // List of plugin libraries.
   Plugin_manager* plugins_;
+  // The parsed output of --dynamic-list files.  For convenience in
+  // script.cc, we store this as a Script_options object, even though
+  // we only use a single Version_tree from it.
+  Script_options dynamic_list_;
 };
 
 // The position-dependent options.  We use this to store the state of
Index: script.cc
===================================================================
RCS file: /cvs/src/src/gold/script.cc,v
retrieving revision 1.47
diff -u -r1.47 script.cc
--- script.cc	13 Aug 2008 07:37:46 -0000	1.47
+++ script.cc	5 Nov 2008 07:48:20 -0000
@@ -184,7 +184,9 @@
     // Reading an expression in a linker script.
     EXPRESSION,
     // Reading a version script.
-    VERSION_SCRIPT
+    VERSION_SCRIPT,
+    // Reading a --dynamic-list file.
+    DYNAMIC_LIST
   };
 
   Lex(const char* input_string, size_t input_length, int parsing_token)
@@ -393,8 +395,9 @@
     case '~':
       return this->mode_ == LINKER_SCRIPT && can_continue_name(&c2);
 
-    case '*': case '[': 
+    case '*': case '[':
       return (this->mode_ == VERSION_SCRIPT
+              || this->mode_ == DYNAMIC_LIST
 	      || (this->mode_ == LINKER_SCRIPT
 		  && can_continue_name(&c2)));
 
@@ -437,19 +440,21 @@
       return NULL;
 
     case '[': case ']': case '*': case '?': case '-':
-      if (this->mode_ == LINKER_SCRIPT || this->mode_ == VERSION_SCRIPT)
+      if (this->mode_ == LINKER_SCRIPT || this->mode_ == VERSION_SCRIPT
+          || this->mode_ == DYNAMIC_LIST)
         return c + 1;
       return NULL;
 
     case '^':
-      if (this->mode_ == VERSION_SCRIPT)
+      if (this->mode_ == VERSION_SCRIPT || this->mode_ == DYNAMIC_LIST)
         return c + 1;
       return NULL;
 
     case ':':
       if (this->mode_ == LINKER_SCRIPT)
         return c + 1;
-      else if (this->mode_ == VERSION_SCRIPT && (c[1] == ':'))
+      else if ((this->mode_ == VERSION_SCRIPT || this->mode_ == DYNAMIC_LIST)
+               && (c[1] == ':'))
         {
           // A name can have '::' in it, as that's a c++ namespace
           // separator. But a single colon is not part of a name.
@@ -1161,7 +1166,7 @@
       command_line_(command_line), script_options_(script_options),
       version_script_info_(script_options->version_script_info()),
       lex_(lex), lineno_(0), charpos_(0), lex_mode_stack_(), inputs_(NULL)
-  { 
+  {
     // We start out processing C symbols in the default lex mode.
     language_stack_.push_back("");
     lex_mode_stack_.push_back(lex->mode());
@@ -1373,6 +1378,7 @@
 
 static bool
 read_script_file(const char* filename, Command_line* cmdline,
+                 Script_options* script_options,
                  int first_token, Lex::Mode lex_mode)
 {
   // TODO: if filename is a relative filename, search for it manually
@@ -1404,7 +1410,7 @@
 			 false,
 			 input_file.is_in_sysroot(),
                          cmdline,
-			 &cmdline->script_options(),
+			 script_options,
 			 &lex);
   if (yyparse(&closure) != 0)
     {
@@ -1425,21 +1431,57 @@
 bool
 read_commandline_script(const char* filename, Command_line* cmdline)
 {
-  return read_script_file(filename, cmdline,
+  return read_script_file(filename, cmdline, &cmdline->script_options(),
                           PARSING_LINKER_SCRIPT, Lex::LINKER_SCRIPT);
 }
 
-// FILE was found as an argument to --version-script.  Read it as a
-// version script, and store its contents in
+// FILENAME was found as an argument to --version-script.  Read it as
+// a version script, and store its contents in
 // cmdline->script_options()->version_script_info().
 
 bool
 read_version_script(const char* filename, Command_line* cmdline)
 {
-  return read_script_file(filename, cmdline,
+  return read_script_file(filename, cmdline, &cmdline->script_options(),
                           PARSING_VERSION_SCRIPT, Lex::VERSION_SCRIPT);
 }
 
+// FILENAME was found as an argument to --dynamic-list.  Read it as a
+// list of symbols, and store its contents in
+// cmdline->script_options()->dynamic_list().
+
+bool
+read_dynamic_list(const char* filename, Command_line* cmdline,
+                  Script_options* dynamic_list)
+{
+  return read_script_file(filename, cmdline, dynamic_list,
+                          PARSING_DYNAMIC_LIST, Lex::DYNAMIC_LIST);
+}
+
+// Implements --dynamic-list-data, --dynamic-list-cpp-new, etc.
+// This is like read_dynamic_list, except instead of taking
+// the data from a file, it takes it from the string DEFINITION.
+
+bool
+Script_options::define_dynamic_list(const char* definition)
+{
+  Lex lex(definition, strlen(definition), PARSING_DYNAMIC_LIST);
+  lex.set_mode(Lex::DYNAMIC_LIST);
+
+  // Dummy value.
+  Position_dependent_options posdep_options;
+
+  Parser_closure closure("command line", posdep_options, false, false, NULL,
+			 this, &lex);
+
+  if (yyparse(&closure) != 0)
+    return false;
+
+  gold_assert(!closure.saw_inputs());
+
+  return true;
+}
+
 // Implement the --defsym option on the command line.  Return true if
 // all is well.
 
@@ -1622,6 +1664,19 @@
                         (sizeof(version_script_keyword_parsecodes)
                          / sizeof(version_script_keyword_parsecodes[0])));
 
+static const Keyword_to_parsecode::Keyword_parsecode
+dynamic_list_keyword_parsecodes[] =
+{
+  { "extern", EXTERN },
+};
+
+static const Keyword_to_parsecode
+dynamic_list_keywords(&dynamic_list_keyword_parsecodes[0],
+                      (sizeof(dynamic_list_keyword_parsecodes)
+                       / sizeof(dynamic_list_keyword_parsecodes[0])));
+
+
+
 // Comparison function passed to bsearch.
 
 extern "C"
@@ -1963,6 +2018,9 @@
           case Lex::VERSION_SCRIPT:
             parsecode = version_script_keywords.keyword_to_parsecode(str, len);
             break;
+          case Lex::DYNAMIC_LIST:
+            parsecode = dynamic_list_keywords.keyword_to_parsecode(str, len);
+            break;
           default:
             break;
           }
@@ -2339,7 +2397,7 @@
 // Finish processing entries for an output section.
 
 extern "C" void
-script_finish_output_section(void* closurev, 
+script_finish_output_section(void* closurev,
 			     const struct Parser_output_section_trailer* trail)
 {
   Parser_closure* closure = static_cast<Parser_closure*>(closurev);
Index: script.h
===================================================================
RCS file: /cvs/src/src/gold/script.h,v
retrieving revision 1.21
diff -u -r1.21 script.h
--- script.h	13 Aug 2008 07:37:46 -0000	1.21
+++ script.h	5 Nov 2008 07:48:20 -0000
@@ -308,6 +308,10 @@
   bool
   define_symbol(const char* definition);
 
+  // Define a dynamic-list entry from the command line (eg dynamic-list-data).
+  bool
+  define_dynamic_list(const char* definition);
+
   // Create sections required by any linker scripts.
   void
   create_script_sections(Layout*);
@@ -398,7 +402,7 @@
 // Read it as a script, and execute its contents immediately.
 
 bool
-read_commandline_script(const char* filename, Command_line*);
+read_commandline_script(const char* filename, Command_line* cmdline);
 
 // FILE was found as an argument to --version-script.  Read it as a
 // version script, and store its contents in
@@ -407,6 +411,14 @@
 bool
 read_version_script(const char* filename, Command_line* cmdline);
 
+// FILE was found as an argument to --dynamic-list.  Read it as a
+// version script (actually, a versym_node from a version script), and
+// store its contents in cmdline->dynamic_list().
+
+bool
+read_dynamic_list(const char* filename, Command_line* cmdline,
+                  Script_options* dynamic_list);
+
 } // End namespace gold.
 
 #endif // !defined(GOLD_SCRIPT_H)
Index: symtab.cc
===================================================================
RCS file: /cvs/src/src/gold/symtab.cc,v
retrieving revision 1.111
diff -u -r1.111 symtab.cc
--- symtab.cc	29 Sep 2008 21:10:26 -0000	1.111
+++ symtab.cc	5 Nov 2008 07:48:20 -0000
@@ -37,6 +37,7 @@
 #include "target.h"
 #include "workqueue.h"
 #include "symtab.h"
+#include "demangle.h"   // needed for --dynamic-list-cpp-new
 #include "plugin.h"
 
 namespace gold
@@ -288,6 +289,9 @@
   this->value_ = value;
 }
 
+// The ""'s around str ensure str is a string literal, so sizeof works.
+#define strprefix(var, str)   (strncmp(var, str, sizeof("" str "")-1) == 0)
+
 // Return true if this symbol should be added to the dynamic symbol
 // table.
 
@@ -302,6 +306,49 @@
   if (this->is_forced_local())
     return false;
 
+  // If the symbol was forced dynamic in a --dynamic-list file, add it.
+  if (parameters->options().in_dynamic_list(this->name()))
+    return true;
+
+  // If dynamic-list-data was specified, add any STT_OBJECT.
+  if (parameters->options().dynamic_list_data()
+      && !this->is_from_dynobj()
+      && this->type() == elfcpp::STT_OBJECT)
+    return true;
+
+  // If --dynamic-list-cpp-new was specified, add any new/delete symbol.
+  // If --dynamic-list-cpp-typeinfo was specified, add any typeinfo symbols.
+  if ((parameters->options().dynamic_list_cpp_new()
+       || parameters->options().dynamic_list_cpp_typeinfo())
+      && !this->is_from_dynobj()
+      && this->type() == elfcpp::STT_OBJECT)
+    {
+      // TODO(csilvers): We could probably figure out if we're an operator
+      //                 new/delete or typeinfo without the need to demangle.
+      char* demangled_name = cplus_demangle(this->name(),
+                                            DMGL_ANSI | DMGL_PARAMS);
+      if (demangled_name == NULL)
+        {
+          // Not a C++ symbol, so it can't satisfy these flags
+        }
+      else if (parameters->options().dynamic_list_cpp_new()
+               && (strprefix(demangled_name, "operator new")
+                   || strprefix(demangled_name, "operator delete")))
+        {
+          free(demangled_name);
+          return true;
+        }
+      else if (parameters->options().dynamic_list_cpp_typeinfo()
+               && (strprefix(demangled_name, "typeinfo name for")
+                   || strprefix(demangled_name, "typeinfo for")))
+        {
+          free(demangled_name);
+          return true;
+        }
+      else
+        free(demangled_name);
+    }
+
   // If exporting all symbols or building a shared library,
   // and the symbol is defined in a regular object and is
   // externally visible, we need to add it.
Index: yyscript.y
===================================================================
RCS file: /cvs/src/src/gold/yyscript.y,v
retrieving revision 1.16
diff -u -r1.16 yyscript.y
--- yyscript.y	13 Aug 2008 07:37:46 -0000	1.16
+++ yyscript.y	5 Nov 2008 07:48:20 -0000
@@ -193,6 +193,7 @@
 %token PARSING_LINKER_SCRIPT
 %token PARSING_VERSION_SCRIPT
 %token PARSING_DEFSYM
+%token PARSING_DYNAMIC_LIST
 
 /* Non-terminal types, where needed.  */
 
@@ -222,6 +223,7 @@
 	  PARSING_LINKER_SCRIPT linker_script
 	| PARSING_VERSION_SCRIPT version_script
 	| PARSING_DEFSYM defsym_expr
+        | PARSING_DYNAMIC_LIST dynamic_list_expr
 	;
 
 /* A file contains a list of commands.  */
@@ -836,6 +838,24 @@
 	    { script_set_symbol(closure, $1.value, $1.length, $3, 0, 0); }
 	;
 
+/* Handle the --dynamic-list option.  A dynamic list has the format
+   { sym1; sym2; extern "C++" { namespace::sym3 }; };
+   We store the symbol we see in the "local" list; that is where
+   Command_line::in_dynamic_list() will look to do its check.
+   TODO(csilvers): More than one of these brace-lists can appear, and
+   should just be merged and treated as a single list.  */
+dynamic_list_expr: dynamic_list_nodes ;
+
+dynamic_list_nodes:
+	  dynamic_list_node
+	| dynamic_list_nodes dynamic_list_node
+        ;
+
+dynamic_list_node:
+          '{' vers_defns ';' '}' ';'
+            { script_new_vers_node (closure, NULL, $2); }
+        ;
+
 /* A version script.  */
 version_script:
 	  vers_nodes
Index: testsuite/Makefile.am
===================================================================
RCS file: /cvs/src/src/gold/testsuite/Makefile.am,v
retrieving revision 1.78
diff -u -r1.78 Makefile.am
--- testsuite/Makefile.am	29 Sep 2008 21:23:02 -0000	1.78
+++ testsuite/Makefile.am	5 Nov 2008 07:48:20 -0000
@@ -903,6 +903,21 @@
 script_test_4.stdout: script_test_4
 	$(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
 
+# Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
+# and --dynamic-list-cpp-typeinfo
+
+check_SCRIPTS += dynamic_list.sh
+check_DATA += dynamic_list.stdout
+MOSTLYCLEANFILES += dynamic_list.stdout
+dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t
+	$(CXXLINK) -Bgcctestdir/ basic_test.o \
+	  -Wl,--dynamic-list $(srcdir)/dynamic_list.t \
+	  -Wl,--dynamic-list-data \
+	  -Wl,--dynamic-list-cpp-new \
+	  -Wl,--dynamic-list-cpp-typeinfo
+dynamic_list.stdout: dynamic_list
+	$(TEST_READELF) -DWs dynamic_list > dynamic_list.stdout
+
 check_PROGRAMS += thin_archive_test_1
 thin_archive_test_1_SOURCES = thin_archive_main.cc
 thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
Index: testsuite/Makefile.in
===================================================================
RCS file: /cvs/src/src/gold/testsuite/Makefile.in,v
retrieving revision 1.83
diff -u -r1.83 Makefile.in
--- testsuite/Makefile.in	29 Sep 2008 21:23:02 -0000	1.83
+++ testsuite/Makefile.in	5 Nov 2008 07:48:20 -0000
@@ -162,13 +162,16 @@
 # Test --detect-odr-violations
 
 # Similar to --detect-odr-violations: check for undefined symbols in .so's
+
+# Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
+# and --dynamic-list-cpp-typeinfo
 @GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_6 = weak_plt.sh debug_msg.sh \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@	undef_symbol.sh ver_test_2.sh \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@	ver_test_4.sh ver_test_5.sh \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@	ver_test_7.sh ver_test_10.sh \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@	ver_matching_test.sh \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@	script_test_3.sh \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@	script_test_4.sh
+@GCC_TRUE@@NATIVE_LINKER_TRUE@	script_test_4.sh dynamic_list.sh
 
 # Create the data files that debug_msg.sh analyzes.
 
@@ -184,7 +187,8 @@
 @GCC_TRUE@@NATIVE_LINKER_TRUE@	ver_test_7.syms ver_test_10.syms \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@	ver_matching_test.stdout \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@	script_test_3.stdout \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@	script_test_4.stdout
+@GCC_TRUE@@NATIVE_LINKER_TRUE@	script_test_4.stdout \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@	dynamic_list.stdout
 @GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@am__append_8 = tls_test \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@	tls_pic_test \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@@TLS_TRUE@	tls_shared_test \
@@ -229,7 +233,8 @@
 @GCC_TRUE@@NATIVE_LINKER_TRUE@	undef_symbol.err \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@	ver_matching_test.stdout \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@	script_test_3.stdout \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@	script_test_4.stdout
+@GCC_TRUE@@NATIVE_LINKER_TRUE@	script_test_4.stdout \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@	dynamic_list.stdout
 
 # Test -o when emitting to a special file (such as something in /dev).
 @GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_17 = flagstest_o_specialfile
@@ -1458,9 +1463,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  testsuite/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  testsuite/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  testsuite/Makefile
+	  $(AUTOMAKE) --gnu  testsuite/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -2418,6 +2423,14 @@
 @GCC_TRUE@@NATIVE_LINKER_TRUE@	$(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_4.t
 @GCC_TRUE@@NATIVE_LINKER_TRUE@script_test_4.stdout: script_test_4
 @GCC_TRUE@@NATIVE_LINKER_TRUE@	$(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
+@GCC_TRUE@@NATIVE_LINKER_TRUE@dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t
+@GCC_TRUE@@NATIVE_LINKER_TRUE@	$(CXXLINK) -Bgcctestdir/ basic_test.o \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@	  -Wl,--dynamic-list $(srcdir)/dynamic_list.t \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@	  -Wl,--dynamic-list-data \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@	  -Wl,--dynamic-list-cpp-new \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@	  -Wl,--dynamic-list-cpp-typeinfo
+@GCC_TRUE@@NATIVE_LINKER_TRUE@dynamic_list.stdout: dynamic_list
+@GCC_TRUE@@NATIVE_LINKER_TRUE@	$(TEST_READELF) -DWs dynamic_list > dynamic_list.stdout
 
 @GCC_TRUE@@NATIVE_LINKER_TRUE@libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
 @GCC_TRUE@@NATIVE_LINKER_TRUE@	rm -f $@
--- /dev/null	2007-10-18 09:27:25.000000000 -0700
+++ testsuite/dynamic_list.t	2008-11-04 17:37:14.673919000 -0800
@@ -0,0 +1,11 @@
+{
+  main;
+  not_a_symbol;
+  global;
+  extern "C++" { t1_6* };
+};
+{
+  extern "C++" { t16a* };
+  local;
+  extern;
+};
--- /dev/null	2007-10-18 09:27:25.000000000 -0700
+++ testsuite/dynamic_list.sh	2008-11-04 23:46:34.558425000 -0800
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+# dynamic_list.sh -- test --dynamic-list and --dynamic-list-*
+
+# Copyright 2008 Free Software Foundation, Inc.
+# Written by Ian Lance Taylor <iant@google.com>.
+
+# This file is part of gold.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+# This file goes with dynamic_list.t, which is a dynamic-list script.
+
+check()
+{
+    if ! grep -qw "$2" "$1"
+    then
+	echo "Did not find expected text in $1:"
+	echo "   $2"
+	echo ""
+	echo "Actual output below:"
+	cat "$1"
+	exit 1
+    fi
+}
+
+check dynamic_list.stdout "main"            # comes via --dynamic-list
+check dynamic_list.stdout "_ZdlPv"          # "operator delete(void*)"
+check dynamic_list.stdout "_Z4t1_6v"        # t1_6()
+check dynamic_list.stdout "_ZN4t16aC2Ev"    # t16a:t16a()
+check dynamic_list.stdout "_ZN4t16aD1Ev"    # t16a:~t16a()
+check dynamic_list.stdout "_ZN4t16a1tEv"    # t16a:t()
+check dynamic_list.stdout "_ZTI4t16a"       # typeinfo for t16a
+check dynamic_list.stdout "_ZTI4t16b"       # typeinfo for t16b
+check dynamic_list.stdout "_ZTS4t16a"       # typeinfo name for t16a
+check dynamic_list.stdout "_ZTS4t16b"       # typeinfo name for t16b
+check dynamic_list.stdout "t20v"            # comes via --dynamic-list-data
--- /dev/null	2007-10-18 09:27:25.000000000 -0700
+++ testsuite/dynamic_list.stdout	2008-11-05 00:01:38.980320000 -0800
@@ -0,0 +1,41 @@
+
+Symbol table for image:
+  Num Buc:    Value  Size   Type   Bind Vis      Ndx Name
+   34   1: 080486ac    38    FUNC   WEAK DEFAULT   2 _ZN4t16aD0Ev
+   12   1: 00000000     0  NOTYPE   WEAK DEFAULT UND _Jv_RegisterClasses
+   25   3: 0804a13c     4  OBJECT GLOBAL DEFAULT  17 t10
+   16   3: 0804a26c     4  OBJECT GLOBAL DEFAULT  23 t16v
+   33   4: 08048686    38    FUNC   WEAK DEFAULT   2 _ZN4t16aD1Ev
+   24   4: 0804a134     4  OBJECT GLOBAL DEFAULT  17 t11
+    8   4: 080484be   243    FUNC GLOBAL DEFAULT   2 main
+   22   5: 0804a130     4  OBJECT GLOBAL DEFAULT  17 t12
+   32   6: 080488c0    20  OBJECT   WEAK DEFAULT   3 _ZTV4t16a
+   20   6: 0804a12c     4  OBJECT GLOBAL DEFAULT  17 t13
+   37   7: 08048660    38    FUNC   WEAK DEFAULT   2 _ZN4t16aD2Ev
+   27   7: 08048888    20  OBJECT   WEAK DEFAULT   3 _ZTV4t16b
+   19   7: 0804a118     4  OBJECT GLOBAL DEFAULT  17 t14
+   17   8: 0804a114     4  OBJECT GLOBAL DEFAULT  17 t15
+   10   8: 00000000     0  NOTYPE   WEAK DEFAULT UND __gmon_start__
+    6  12: 00000000     0    FUNC GLOBAL DEFAULT UND __cxa_atexit
+   35  13: 080486d2    10    FUNC   WEAK DEFAULT   2 _ZN4t16a1tEv
+   14  14: 0804a10c     8  OBJECT GLOBAL DEFAULT  17 t19v
+    2  14: 00000000     0    FUNC GLOBAL DEFAULT UND __libc_start_main
+   13  15: 0804a264     4  OBJECT GLOBAL DEFAULT  23 t20v
+    3  16: 0804a2e0    44  OBJECT GLOBAL DEFAULT  23 _ZTVN10__cxxabiv117__class_type_infoE
+   31  18: 080488b0     6  OBJECT   WEAK DEFAULT   3 _ZTS4t16a
+   26  18: 0804a150     4  OBJECT GLOBAL DEFAULT  17 t1
+   29  19: 080488b6     6  OBJECT   WEAK DEFAULT   3 _ZTS4t16b
+   23  20: 0804a280     4  OBJECT GLOBAL DEFAULT  23 t3
+    1  20: 08048a70     0    FUNC GLOBAL DEFAULT UND __gxx_personality_v0
+   30  21: 080488a8     8  OBJECT   WEAK DEFAULT   3 _ZTI4t16a
+   21  21: 0804a140    13  OBJECT GLOBAL DEFAULT  17 t4
+    9  21: 08048884     4  OBJECT GLOBAL DEFAULT   3 _IO_stdin_used
+   28  22: 0804889c    12  OBJECT   WEAK DEFAULT   3 _ZTI4t16b
+   18  23: 0804a270    13  OBJECT GLOBAL DEFAULT  23 t6
+   36  25: 080481f0    85    FUNC GLOBAL DEFAULT   2 _Z4t1_6v
+    7  27: 08048880     4  OBJECT GLOBAL DEFAULT   3 _fp_hw
+    4  31: 0804a2a0    44  OBJECT GLOBAL DEFAULT  23 _ZTVN10__cxxabiv120__si_class_type_infoE
+   38  33: 08048786    15    FUNC   WEAK DEFAULT   2 _ZN4t16aC2Ev
+    5  34: 00000000     0    FUNC GLOBAL DEFAULT UND _ZdlPv
+   15  35: 0804a268     1  OBJECT GLOBAL DEFAULT  23 t18v
+   11  36: 0804a104     0  OBJECT GLOBAL HIDDEN  17 __dso_handle


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