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]

[gold patch committed] PR 11855: Handle script references


PR 11855 points out that gold does not handle symbol references in
scripts correctly.  This patch makes gold handle symbol referenes in
scripts just like symbols passed to -u on the command line.  A lot of
the patch is fairly mechanical so that some code gets access to the
Layout object.  Committed to mainline.

Ian


2010-08-02  Ian Lance Taylor  <iant@google.com>

	PR 11855
	* script.cc (Script_options::Script_options): Initialize
	symbol_definitions_ and symbol_references_.
	(Script_options::add_symbol_assignment): Update
	symbol_definitions_ and symbol_references_.
	(Script_options::add_symbol_reference): New function.
	(script_symbol): New function.
	* script.h (class Script_options): Add symbol_definitions_ and
	symbol_references_ fields.
	(Script_options::referenced_const_iterator): New type.
	(Script_options::referenced_begin): New function.
	(Script_options::referenced_end): New function.
	(Script_options::is_referenced): New function.
	(Script_options::any_unreferenced): New function.
	* script-c.h (script_symbol): Declare.
	* yyscript.y (exp): Call script_symbol.
	* symtab.cc: Include "script.h".
	(Symbol_table::gc_mark_undef_symbols): Add layout parameter.
	Change all callers.  Check symbols referenced by scripts.
	(Symbol_table::add_undefined_symbols_from_command_line): Add
	layout parameter.  Change all callers.
	(Symbol_table::do_add_undefined_symbols_from_command_line):
	Likewise.  Break out loop body.  Check symbols referenced by
	scripts.
	(Symbol_table::add_undefined_symbol_from_command_line): New
	function broken out of
	do_add_undefined_symbols_from_command_line.
	* symtab.h (class Symbol_table): Update declarations.
	* archive.cc: Include "layout.h".
	(Archive::should_include_member): Add layout parameter.  Change
	all callers.  Check for symbol mentioned in expression.
	* archive.h (class Archive): Update declaration.
	* object.cc (Sized_relobj::do_should_include_member): Add layout
	parameter.
	* object.h (Object::should_include_member): Add layout parameter.
	Change all callers.
	(Object::do_should_include_member): Add layout parameter.
	(class Sized_relobj): Update declaration.
	* dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
	parameter.
	* dynobj.h (class Sized_dynobj): Update declaration.
	* plugin.cc (Sized_pluginobj::do_should_include_member): Add
	layout parameter.
	* plugin.h (class Sized_pluginobj): Update declaration.


? autom4te.cache
Index: archive.cc
===================================================================
RCS file: /cvs/src/src/gold/archive.cc,v
retrieving revision 1.54
diff -p -u -r1.54 archive.cc
--- archive.cc	13 Jul 2010 07:56:08 -0000	1.54
+++ archive.cc	2 Aug 2010 13:24:14 -0000
@@ -36,6 +36,7 @@
 #include "readsyms.h"
 #include "symtab.h"
 #include "object.h"
+#include "layout.h"
 #include "archive.h"
 #include "plugin.h"
 
@@ -603,8 +604,9 @@ Archive::read_symbols(off_t off)
 }
 
 Archive::Should_include
-Archive::should_include_member(Symbol_table* symtab, const char* sym_name,
-                               Symbol** symp, std::string* why, char** tmpbufp,
+Archive::should_include_member(Symbol_table* symtab, Layout* layout,
+			       const char* sym_name, Symbol** symp,
+			       std::string* why, char** tmpbufp,
                                size_t* tmpbuflen)
 {
   // In an object file, and therefore in an archive map, an
@@ -648,13 +650,22 @@ Archive::should_include_member(Symbol_ta
   if (sym == NULL)
     {
       // Check whether the symbol was named in a -u option.
-      if (!parameters->options().is_undefined(sym_name))
-	return Archive::SHOULD_INCLUDE_UNKNOWN;
-      else
+      if (parameters->options().is_undefined(sym_name))
         {
           *why = "-u ";
           *why += sym_name;
         }
+      else if (layout->script_options()->is_referenced(sym_name))
+	{
+	  size_t alc = 100 + strlen(sym_name);
+	  char* buf = new char[alc];
+	  snprintf(buf, alc, _("script or expression reference to %s"),
+		   sym_name);
+	  *why = buf;
+	  delete[] buf;
+	}
+      else
+	return Archive::SHOULD_INCLUDE_UNKNOWN;
     }
   else if (!sym->is_undefined())
     return Archive::SHOULD_INCLUDE_NO;
@@ -726,8 +737,8 @@ Archive::add_symbols(Symbol_table* symta
           Symbol* sym;
           std::string why;
           Archive::Should_include t =
-              Archive::should_include_member(symtab, sym_name, &sym, &why,
-                                             &tmpbuf, &tmpbuflen);
+	    Archive::should_include_member(symtab, layout, sym_name, &sym,
+					   &why, &tmpbuf, &tmpbuflen);
 
 	  if (t == Archive::SHOULD_INCLUDE_NO
               || t == Archive::SHOULD_INCLUDE_YES)
@@ -1015,6 +1026,7 @@ Lib_group::add_symbols(Symbol_table* sym
 	      && (member.sd_ == NULL || member.sd_->symbol_names != NULL))
             {
 	      Archive::Should_include t = obj->should_include_member(symtab,
+								     layout,
 								     member.sd_,
 								     &why);
 
Index: archive.h
===================================================================
RCS file: /cvs/src/src/gold/archive.h,v
retrieving revision 1.27
diff -p -u -r1.27 archive.h
--- archive.h	22 Mar 2010 14:18:24 -0000	1.27
+++ archive.h	2 Aug 2010 13:24:14 -0000
@@ -176,7 +176,7 @@ class Archive
   };
 
   static Should_include
-  should_include_member(Symbol_table* symtab, const char* sym_name,
+  should_include_member(Symbol_table* symtab, Layout*, const char* sym_name,
                         Symbol** symp, std::string* why, char** tmpbufp,
                         size_t* tmpbuflen);
 
Index: dynobj.cc
===================================================================
RCS file: /cvs/src/src/gold/dynobj.cc,v
retrieving revision 1.58
diff -p -u -r1.58 dynobj.cc
--- dynobj.cc	22 Mar 2010 14:18:24 -0000	1.58
+++ dynobj.cc	2 Aug 2010 13:24:14 -0000
@@ -753,8 +753,10 @@ Sized_dynobj<size, big_endian>::do_add_s
 
 template<int size, bool big_endian>
 Archive::Should_include
-Sized_dynobj<size, big_endian>::do_should_include_member(
-    Symbol_table*, Read_symbols_data*, std::string*)
+Sized_dynobj<size, big_endian>::do_should_include_member(Symbol_table*,
+							 Layout*,
+							 Read_symbols_data*,
+							 std::string*)
 {
   return Archive::SHOULD_INCLUDE_YES;
 }
Index: dynobj.h
===================================================================
RCS file: /cvs/src/src/gold/dynobj.h,v
retrieving revision 1.39
diff -p -u -r1.39 dynobj.h
--- dynobj.h	22 Mar 2010 14:18:24 -0000	1.39
+++ dynobj.h	2 Aug 2010 13:24:14 -0000
@@ -178,7 +178,7 @@ class Sized_dynobj : public Dynobj
   do_add_symbols(Symbol_table*, Read_symbols_data*, Layout*);
 
   Archive::Should_include
-  do_should_include_member(Symbol_table* symtab, Read_symbols_data*,
+  do_should_include_member(Symbol_table* symtab, Layout*, Read_symbols_data*,
                            std::string* why);
 
   // Get the size of a section.
Index: gold.cc
===================================================================
RCS file: /cvs/src/src/gold/gold.cc,v
retrieving revision 1.82
diff -p -u -r1.82 gold.cc
--- gold.cc	15 Apr 2010 00:42:15 -0000	1.82
+++ gold.cc	2 Aug 2010 13:24:15 -0000
@@ -309,7 +309,7 @@ queue_middle_tasks(const General_options
 		   Mapfile* mapfile)
 {
   // Add any symbols named with -u options to the symbol table.
-  symtab->add_undefined_symbols_from_command_line();
+  symtab->add_undefined_symbols_from_command_line(layout);
 
   // If garbage collection was chosen, relocs have been read and processed
   // at this point by pre_middle_tasks.  Layout can then be done for all 
@@ -333,7 +333,7 @@ queue_middle_tasks(const General_options
             }
         }
       // Symbols named with -u should not be considered garbage.
-      symtab->gc_mark_undef_symbols();
+      symtab->gc_mark_undef_symbols(layout);
       gold_assert(symtab->gc() != NULL);
       // Do a transitive closure on all references to determine the worklist.
       symtab->gc()->do_transitive_closure();
Index: object.cc
===================================================================
RCS file: /cvs/src/src/gold/object.cc,v
retrieving revision 1.126
diff -p -u -r1.126 object.cc
--- object.cc	12 Jul 2010 17:59:58 -0000	1.126
+++ object.cc	2 Aug 2010 13:24:15 -0000
@@ -1614,6 +1614,7 @@ Sized_relobj<size, big_endian>::do_add_s
 template<int size, bool big_endian>
 Archive::Should_include
 Sized_relobj<size, big_endian>::do_should_include_member(Symbol_table* symtab,
+							 Layout* layout,
                                                          Read_symbols_data* sd,
                                                          std::string* why)
 {
@@ -1639,7 +1640,9 @@ Sized_relobj<size, big_endian>::do_shoul
       unsigned int st_name = sym.get_st_name();
       const char* name = sym_names + st_name;
       Symbol* symbol;
-      Archive::Should_include t = Archive::should_include_member(symtab, name,
+      Archive::Should_include t = Archive::should_include_member(symtab,
+								 layout,
+								 name,
 								 &symbol, why,
 								 &tmpbuf,
 								 &tmpbuflen);
Index: object.h
===================================================================
RCS file: /cvs/src/src/gold/object.h,v
retrieving revision 1.97
diff -p -u -r1.97 object.h
--- object.h	12 Jul 2010 17:59:58 -0000	1.97
+++ object.h	2 Aug 2010 13:24:15 -0000
@@ -405,9 +405,9 @@ class Object
 
   // Add symbol information to the global symbol table.
   Archive::Should_include
-  should_include_member(Symbol_table* symtab, Read_symbols_data* sd,
-                        std::string* why)
-  { return this->do_should_include_member(symtab, sd, why); }
+  should_include_member(Symbol_table* symtab, Layout* layout,
+			Read_symbols_data* sd, std::string* why)
+  { return this->do_should_include_member(symtab, layout, sd, why); }
 
   // Functions and types for the elfcpp::Elf_file interface.  This
   // permit us to use Object as the File template parameter for
@@ -546,7 +546,7 @@ class Object
   do_add_symbols(Symbol_table*, Read_symbols_data*, Layout*) = 0;
 
   virtual Archive::Should_include
-  do_should_include_member(Symbol_table* symtab, Read_symbols_data*,
+  do_should_include_member(Symbol_table* symtab, Layout*, Read_symbols_data*,
                            std::string* why) = 0;
 
   // Return the location of the contents of a section.  Implemented by
@@ -1623,7 +1623,7 @@ class Sized_relobj : public Relobj
   do_add_symbols(Symbol_table*, Read_symbols_data*, Layout*);
 
   Archive::Should_include
-  do_should_include_member(Symbol_table* symtab, Read_symbols_data*,
+  do_should_include_member(Symbol_table* symtab, Layout*, Read_symbols_data*,
                            std::string* why);
 
   // Read the relocs.
Index: plugin.cc
===================================================================
RCS file: /cvs/src/src/gold/plugin.cc,v
retrieving revision 1.36
diff -p -u -r1.36 plugin.cc
--- plugin.cc	15 Jul 2010 17:36:23 -0000	1.36
+++ plugin.cc	2 Aug 2010 13:24:15 -0000
@@ -705,26 +705,32 @@ Sized_pluginobj<size, big_endian>::do_ad
 template<int size, bool big_endian>
 Archive::Should_include
 Sized_pluginobj<size, big_endian>::do_should_include_member(
-    Symbol_table* symtab, Read_symbols_data*, std::string* why)
+    Symbol_table* symtab,
+    Layout* layout,
+    Read_symbols_data*,
+    std::string* why)
 {
   char* tmpbuf = NULL;
   size_t tmpbuflen = 0;
 
-  for (int i = 0; i < this->nsyms_; ++i) {
-    const struct ld_plugin_symbol& sym = this->syms_[i];
-    const char* name = sym.name;
-    Symbol* symbol;
-    Archive::Should_include t = Archive::should_include_member(symtab, name,
-                                                               &symbol, why,
-                                                               &tmpbuf,
-                                                               &tmpbuflen);
+  for (int i = 0; i < this->nsyms_; ++i)
+    {
+      const struct ld_plugin_symbol& sym = this->syms_[i];
+      const char* name = sym.name;
+      Symbol* symbol;
+      Archive::Should_include t = Archive::should_include_member(symtab,
+								 layout,
+								 name,
+								 &symbol, why,
+								 &tmpbuf,
+								 &tmpbuflen);
       if (t == Archive::SHOULD_INCLUDE_YES)
 	{
 	  if (tmpbuf != NULL)
 	    free(tmpbuf);
 	  return t;
 	}
-  }
+    }
   if (tmpbuf != NULL)
     free(tmpbuf);
   return Archive::SHOULD_INCLUDE_UNKNOWN;
Index: plugin.h
===================================================================
RCS file: /cvs/src/src/gold/plugin.h,v
retrieving revision 1.13
diff -p -u -r1.13 plugin.h
--- plugin.h	21 Jun 2010 21:21:24 -0000	1.13
+++ plugin.h	2 Aug 2010 13:24:15 -0000
@@ -376,7 +376,7 @@ class Sized_pluginobj : public Pluginobj
   do_add_symbols(Symbol_table*, Read_symbols_data*, Layout*);
 
   Archive::Should_include
-  do_should_include_member(Symbol_table* symtab, Read_symbols_data*,
+  do_should_include_member(Symbol_table* symtab, Layout*, Read_symbols_data*,
                            std::string* why);
 
   // Get the size of a section.
Index: script-c.h
===================================================================
RCS file: /cvs/src/src/gold/script-c.h,v
retrieving revision 1.18
diff -p -u -r1.18 script-c.h
--- script-c.h	9 Jun 2010 14:14:18 -0000	1.18
+++ script-c.h	2 Aug 2010 13:24:15 -0000
@@ -303,6 +303,14 @@ script_push_lex_into_version_mode(void* 
 extern void
 script_pop_lex_mode(void* closure);
 
+/* Called by the bison parser to get the value of a symbol.  This is
+   called for a reference to a symbol, but is not called for something
+   like "sym += 10".  Uses of the special symbol "." can just call
+   script_exp_string.  */
+
+extern Expression_ptr
+script_symbol(void* closure, const char*, size_t);
+
 /* Called by the bison parser to set a symbol to a value.  PROVIDE is
    non-zero if the symbol should be provided--only defined if there is
    an undefined reference.  HIDDEN is non-zero if the symbol should be
Index: script.cc
===================================================================
RCS file: /cvs/src/src/gold/script.cc,v
retrieving revision 1.73
diff -p -u -r1.73 script.cc
--- script.cc	9 Jun 2010 14:14:18 -0000	1.73
+++ script.cc	2 Aug 2010 13:24:15 -0000
@@ -1045,8 +1045,8 @@ Script_assertion::print(FILE* f) const
 // Class Script_options.
 
 Script_options::Script_options()
-  : entry_(), symbol_assignments_(), version_script_info_(),
-    script_sections_()
+  : entry_(), symbol_assignments_(), symbol_definitions_(),
+    symbol_references_(), version_script_info_(), script_sections_()
 {
 }
 
@@ -1071,6 +1071,13 @@ Script_options::add_symbol_assignment(co
 						       value, provide, hidden);
 	  this->symbol_assignments_.push_back(p);
 	}
+
+      if (!provide)
+	{
+	  std::string n(name, length);
+	  this->symbol_definitions_.insert(n);
+	  this->symbol_references_.erase(n);
+	}
     }
   else
     {
@@ -1084,6 +1091,19 @@ Script_options::add_symbol_assignment(co
     }
 }
 
+// Add a reference to a symbol.
+
+void
+Script_options::add_symbol_reference(const char* name, size_t length)
+{
+  if (length != 1 || name[0] != '.')
+    {
+      std::string n(name, length);
+      if (this->symbol_definitions_.find(n) == this->symbol_definitions_.end())
+	this->symbol_references_.insert(n);
+    }
+}
+
 // Add an assertion.
 
 void
@@ -2679,6 +2699,17 @@ script_set_common_allocation(void* closu
   script_parse_option(closurev, arg, strlen(arg));
 }
 
+// Called by the bison parser to refer to a symbol.
+
+extern "C" Expression*
+script_symbol(void *closurev, const char* name, size_t length)
+{
+  Parser_closure* closure = static_cast<Parser_closure*>(closurev);
+  if (length != 1 || name[0] != '.')
+    closure->script_options()->add_symbol_reference(name, length);
+  return script_exp_string(name, length);
+}
+
 // Called by the bison parser to define a symbol.
 
 extern "C" void
Index: script.h
===================================================================
RCS file: /cvs/src/src/gold/script.h,v
retrieving revision 1.33
diff -p -u -r1.33 script.h
--- script.h	23 Apr 2010 04:47:33 -0000	1.33
+++ script.h	2 Aug 2010 13:24:15 -0000
@@ -423,6 +423,10 @@ class Script_options
   add_symbol_assignment(const char* name, size_t length, bool is_defsym,
 			Expression* value, bool provide, bool hidden);
 
+  // Add a reference to a symbol.
+  void
+  add_symbol_reference(const char* name, size_t length);
+
   // Add an assertion.
   void
   add_assertion(Expression* check, const char* message, size_t messagelen);
@@ -439,6 +443,32 @@ class Script_options
   void
   add_symbols_to_table(Symbol_table*);
 
+  // Used to iterate over symbols which are referenced in expressions
+  // but not defined.
+  typedef Unordered_set<std::string>::const_iterator referenced_const_iterator;
+
+  referenced_const_iterator
+  referenced_begin() const
+  { return this->symbol_references_.begin(); }
+
+  referenced_const_iterator
+  referenced_end() const
+  { return this->symbol_references_.end(); }
+
+  // Return whether a symbol is referenced but not defined.
+  bool
+  is_referenced(const std::string& name) const
+  {
+    return (this->symbol_references_.find(name)
+	    != this->symbol_references_.end());
+  }
+
+  // Return whether there are any symbols which were referenced but
+  // not defined.
+  bool
+  any_unreferenced() const
+  { return !this->symbol_references_.empty(); }
+
   // Finalize the symbol values.  Also check assertions.
   void
   finalize_symbols(Symbol_table*, const Layout*);
@@ -497,6 +527,10 @@ class Script_options
   std::string entry_;
   // Symbols to set.
   Symbol_assignments symbol_assignments_;
+  // Symbols defined in an expression, for faster lookup.
+  Unordered_set<std::string> symbol_definitions_;
+  // Symbols referenced in an expression.
+  Unordered_set<std::string> symbol_references_;
   // Assertions to check.
   Assertions assertions_;
   // Version information parsed from a version script.
Index: symtab.cc
===================================================================
RCS file: /cvs/src/src/gold/symtab.cc,v
retrieving revision 1.141
diff -p -u -r1.141 symtab.cc
--- symtab.cc	9 Jul 2010 01:34:31 -0000	1.141
+++ symtab.cc	2 Aug 2010 13:24:15 -0000
@@ -38,7 +38,7 @@
 #include "target.h"
 #include "workqueue.h"
 #include "symtab.h"
-#include "demangle.h"   // needed for --dynamic-list-cpp-new
+#include "script.h"
 #include "plugin.h"
 
 namespace gold
@@ -530,7 +530,7 @@ Symbol_table::is_section_folded(Object* 
 // work list to avoid gc'ing them.
 
 void 
-Symbol_table::gc_mark_undef_symbols()
+Symbol_table::gc_mark_undef_symbols(Layout* layout)
 {
   for (options::String_set::const_iterator p =
 	 parameters->options().undefined_begin();
@@ -553,6 +553,27 @@ Symbol_table::gc_mark_undef_symbols()
             }
         }
     }
+
+  for (Script_options::referenced_const_iterator p =
+	 layout->script_options()->referenced_begin();
+       p != layout->script_options()->referenced_end();
+       ++p)
+    {
+      Symbol* sym = this->lookup(p->c_str());
+      gold_assert(sym != NULL);
+      if (sym->source() == Symbol::FROM_OBJECT
+	  && !sym->object()->is_dynamic())
+	{
+	  Relobj* obj = static_cast<Relobj*>(sym->object());
+	  bool is_ordinary;
+	  unsigned int shndx = sym->shndx(&is_ordinary);
+	  if (is_ordinary)
+	    {
+	      gold_assert(this->gc_ != NULL);
+	      this->gc_->worklist().push(Section_id(obj, shndx));
+	    }
+	}
+    }
 }
 
 void
@@ -2163,14 +2184,15 @@ Symbol_table::get_copy_source(const Symb
 // Add any undefined symbols named on the command line.
 
 void
-Symbol_table::add_undefined_symbols_from_command_line()
+Symbol_table::add_undefined_symbols_from_command_line(Layout* layout)
 {
-  if (parameters->options().any_undefined())
+  if (parameters->options().any_undefined()
+      || layout->script_options()->any_unreferenced())
     {
       if (parameters->target().get_size() == 32)
 	{
 #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_32_BIG)
-	  this->do_add_undefined_symbols_from_command_line<32>();
+	  this->do_add_undefined_symbols_from_command_line<32>(layout);
 #else
 	  gold_unreachable();
 #endif
@@ -2178,7 +2200,7 @@ Symbol_table::add_undefined_symbols_from
       else if (parameters->target().get_size() == 64)
 	{
 #if defined(HAVE_TARGET_64_LITTLE) || defined(HAVE_TARGET_64_BIG)
-	  this->do_add_undefined_symbols_from_command_line<64>();
+	  this->do_add_undefined_symbols_from_command_line<64>(layout);
 #else
 	  gold_unreachable();
 #endif
@@ -2190,50 +2212,59 @@ Symbol_table::add_undefined_symbols_from
 
 template<int size>
 void
-Symbol_table::do_add_undefined_symbols_from_command_line()
+Symbol_table::do_add_undefined_symbols_from_command_line(Layout* layout)
 {
   for (options::String_set::const_iterator p =
 	 parameters->options().undefined_begin();
        p != parameters->options().undefined_end();
        ++p)
-    {
-      const char* name = p->c_str();
+    this->add_undefined_symbol_from_command_line<size>(p->c_str());
 
-      if (this->lookup(name) != NULL)
-	continue;
+  for (Script_options::referenced_const_iterator p =
+	 layout->script_options()->referenced_begin();
+       p != layout->script_options()->referenced_end();
+       ++p)
+    this->add_undefined_symbol_from_command_line<size>(p->c_str());
+}
+
+template<int size>
+void
+Symbol_table::add_undefined_symbol_from_command_line(const char* name)
+{
+  if (this->lookup(name) != NULL)
+    return;
 
-      const char* version = NULL;
+  const char* version = NULL;
 
-      Sized_symbol<size>* sym;
-      Sized_symbol<size>* oldsym;
-      bool resolve_oldsym;
-      if (parameters->target().is_big_endian())
-	{
+  Sized_symbol<size>* sym;
+  Sized_symbol<size>* oldsym;
+  bool resolve_oldsym;
+  if (parameters->target().is_big_endian())
+    {
 #if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG)
-	  sym = this->define_special_symbol<size, true>(&name, &version,
-							false, &oldsym,
-							&resolve_oldsym);
+      sym = this->define_special_symbol<size, true>(&name, &version,
+						    false, &oldsym,
+						    &resolve_oldsym);
 #else
-	  gold_unreachable();
+      gold_unreachable();
 #endif
-	}
-      else
-	{
+    }
+  else
+    {
 #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE)
-	  sym = this->define_special_symbol<size, false>(&name, &version,
-							 false, &oldsym,
-							 &resolve_oldsym);
+      sym = this->define_special_symbol<size, false>(&name, &version,
+						     false, &oldsym,
+						     &resolve_oldsym);
 #else
-	  gold_unreachable();
+      gold_unreachable();
 #endif
-	}
+    }
 
-      gold_assert(oldsym == NULL);
+  gold_assert(oldsym == NULL);
 
-      sym->init_undefined(name, version, elfcpp::STT_NOTYPE, elfcpp::STB_GLOBAL,
-			  elfcpp::STV_DEFAULT, 0);
-      ++this->saw_undefined_;
-    }
+  sym->init_undefined(name, version, elfcpp::STT_NOTYPE, elfcpp::STB_GLOBAL,
+		      elfcpp::STV_DEFAULT, 0);
+  ++this->saw_undefined_;
 }
 
 // Set the dynamic symbol indexes.  INDEX is the index of the first
Index: symtab.h
===================================================================
RCS file: /cvs/src/src/gold/symtab.h,v
retrieving revision 1.108
diff -p -u -r1.108 symtab.h
--- symtab.h	9 Jul 2010 01:34:31 -0000	1.108
+++ symtab.h	2 Aug 2010 13:24:15 -0000
@@ -1269,7 +1269,7 @@ class Symbol_table
 
   // During garbage collection, this keeps undefined symbols.
   void
-  gc_mark_undef_symbols(); 
+  gc_mark_undef_symbols(Layout*);
 
   // During garbage collection, this ensures externally visible symbols
   // are not treated as garbage while building shared objects.
@@ -1419,7 +1419,7 @@ class Symbol_table
   // Add any undefined symbols named on the command line to the symbol
   // table.
   void
-  add_undefined_symbols_from_command_line();
+  add_undefined_symbols_from_command_line(Layout*);
 
   // SYM is defined using a COPY reloc.  Return the dynamic object
   // where the original definition was found.
@@ -1633,7 +1633,12 @@ class Symbol_table
   // table, sized version.
   template<int size>
   void
-  do_add_undefined_symbols_from_command_line();
+  do_add_undefined_symbols_from_command_line(Layout*);
+
+  // Add one undefined symbol.
+  template<int size>
+  void
+  add_undefined_symbol_from_command_line(const char* name);
 
   // Types of common symbols.
 
Index: yyscript.y
===================================================================
RCS file: /cvs/src/src/gold/yyscript.y,v
retrieving revision 1.24
diff -p -u -r1.24 yyscript.y
--- yyscript.y	9 Jun 2010 14:14:18 -0000	1.24
+++ yyscript.y	2 Aug 2010 13:24:15 -0000
@@ -867,7 +867,7 @@ exp:
 	| INTEGER
 	    { $$ = script_exp_integer($1); }
 	| string
-	    { $$ = script_exp_string($1.value, $1.length); }
+	    { $$ = script_symbol(closure, $1.value, $1.length); }
 	| MAX_K '(' exp ',' exp ')'
 	    { $$ = script_exp_function_max($3, $5); }
 	| MIN_K '(' exp ',' exp ')'

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