This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[committed patch] gold: only set st_size to 0 for undefs from shlibs
- From: cgd at google dot com (Chris Demetriou)
- To: binutils at sourceware dot org
- Cc: cgd at google dot com
- Date: Wed, 23 Jul 2008 09:19:40 -0700 (PDT)
- Subject: [committed patch] gold: only set st_size to 0 for undefs from shlibs
Simon pointed out off-list that I goofed up when I applied the gold
patch to set symbol st_size to 0 -- I didn't apply the latest version
of the patch updated with Ian's final comments.
Here's the difference. Tested i686-linux before/after. Committed
(since this was really what was approved previously).
chris
--
2008-07-23 Simon Baldwin <simonb@google.com>
* symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
to zero for undefined symbols from dynamic libraries.
Index: symtab.cc
===================================================================
RCS file: /cvs/src/src/gold/symtab.cc,v
retrieving revision 1.105
diff -u -u -p -r1.105 symtab.cc
--- symtab.cc 23 Jul 2008 14:36:09 -0000 1.105
+++ symtab.cc 23 Jul 2008 16:15:40 -0000
@@ -2354,8 +2354,11 @@ Symbol_table::sized_write_symbol(
elfcpp::Sym_write<size, big_endian> osym(p);
osym.put_st_name(pool->get_offset(sym->name()));
osym.put_st_value(value);
- // Use a symbol size of zero for undefined symbols.
- osym.put_st_size(shndx == elfcpp::SHN_UNDEF ? 0 : sym->symsize());
+ // Use a symbol size of zero for undefined symbols from shared libraries.
+ if (shndx == elfcpp::SHN_UNDEF && sym->is_from_dynobj())
+ osym.put_st_size(0);
+ else
+ osym.put_st_size(sym->symsize());
// A version script may have overridden the default binding.
if (sym->is_forced_local())
osym.put_st_info(elfcpp::elf_st_info(elfcpp::STB_LOCAL, sym->type()));