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]

Re: [PATCH][RFC] Explicitly set ELF symbol size to zero for undefined symbols -- libbfd, gold


On Mon, Jul 14, 2008 at 03:48, Simon Baldwin <simonb@google.com> wrote:
> This patch explicitly sets the size of undefined ELF symbols to zero for
> linker output.

Ian pointed out off-list that the gold patch had been approved by him
for commit after the bfd patch was done, and that I didn't check it
in.

So, I just applied it, tested (gold / as / binutils on i686-linux),
and checked it in.

[gold/ChangeLog]
2008-07-22  Simon Baldwin  <simonb@google.com>

        * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
        to zero when writing undefined symbols.



chris
[gold/ChangeLog]
2008-07-22  Simon Baldwin  <simonb@google.com>

	* symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
	to zero when writing undefined symbols.

Index: symtab.cc
===================================================================
RCS file: /cvs/src/src/gold/symtab.cc,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -u -p -r1.102 -r1.103
--- symtab.cc	21 Jul 2008 23:36:29 -0000	1.102
+++ symtab.cc	22 Jul 2008 21:02:44 -0000	1.103
@@ -2334,7 +2334,8 @@ 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);
-  osym.put_st_size(sym->symsize());
+  // Use a symbol size of zero for undefined symbols.
+  osym.put_st_size(shndx == elfcpp::SHN_UNDEF ? 0 : 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()));

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