This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
gold patch committed: Don't add undefined symbols to dynsym
- From: Ian Lance Taylor <iant at google dot com>
- To: binutils at sourceware dot org
- Date: Wed, 29 Jun 2011 07:44:22 -0700
- Subject: gold patch committed: Don't add undefined symbols to dynsym
PR 12818 points out that gold is putting a useless symbol in the dynamic
symbol table. It turns out to be a simple bug: if a symbol is never
defined, then gold is putting it in the dynamic symbol table. That is
useless; there is already code to ensure that any symbol mentioned in a
dynamic relocation goes into the dynamic symbol table. This patch fixes
the problemm. Committed to mainline.
Ian
2011-06-29 Ian Lance Taylor <iant@google.com>
PR gold/12818
* symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
symbols which are not used in a relocation.
Index: symtab.cc
===================================================================
RCS file: /cvs/src/src/gold/symtab.cc,v
retrieving revision 1.155
diff -u -p -r1.155 symtab.cc
--- symtab.cc 28 Jun 2011 05:39:45 -0000 1.155
+++ symtab.cc 29 Jun 2011 14:40:51 -0000
@@ -414,6 +414,7 @@ Symbol::should_add_dynsym_entry(Symbol_t
// externally visible, we need to add it.
if ((parameters->options().export_dynamic() || parameters->options().shared())
&& !this->is_from_dynobj()
+ && !this->is_undefined()
&& this->is_externally_visible())
return true;