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 ob] Fix gold internal error with --export-dynamic-symbol


If you link with --export-dynamic-symbol=foo and foo is undefined, we
do not treat it as an error, but if you turn on --gc-sections, we'll
hit an assertion in gc_mark_undef_symbols. This patch removes that
assertion and simply ignores the undefined symbol when marking for gc.

Tested on x86_64. I'm committing this as a trivial and obvious fix.

-cary


2012-08-21  Cary Coutant  <ccoutant@google.com>

gold/
	* symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
	if --export-dynamic-symbol names an undef symbol.


diff --git a/gold/symtab.cc b/gold/symtab.cc
index d49b24b..5d2499f 100644
--- a/gold/symtab.cc
+++ b/gold/symtab.cc
@@ -594,8 +594,10 @@ Symbol_table::gc_mark_undef_symbols(Layout* layout)
     {
       const char* name = p->c_str();
       Symbol* sym = this->lookup(name);
-      gold_assert(sym != NULL);
-      if (sym->source() == Symbol::FROM_OBJECT
+      // It's not an error if a symbol named by --export-dynamic-symbol
+      // is undefined.
+      if (sym != NULL
+	  && sym->source() == Symbol::FROM_OBJECT
           && !sym->object()->is_dynamic())
         {
           Relobj* obj = static_cast<Relobj*>(sym->object());


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