public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [gold][patch] Don't put symbols dropped by the plugin in the symbol tables
@ 2011-02-17 20:13 Rafael Avila de Espindola
  2011-02-18  5:43 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Rafael Avila de Espindola @ 2011-02-17 20:13 UTC (permalink / raw)
  To: binutils; +Cc: iant

[-- Attachment #1: Type: text/plain, Size: 579 bytes --]

The attached patch avoids putting symbols in the symbol tables if there 
are only found in IL files. This is important for when LTO manages to 
drop some symbols completely.

When linking libxul it reduces the final .so from 39339456 bytes to 
34450128 bytes. And yes, firefox still works :-)

2010-02-17  Rafael Ávila de Espíndola <respindola@mozilla.com>

	* symtab.cc (Symbol::should_add_dynsym_entry) Return false for
	plugin only symbols.
	(Symbol_table::sized_finalize_symbol) Mark symbol only present
	in plugin files as not needed in the symbol table.

Cheers,
Rafael


[-- Attachment #2: symtab.patch --]
[-- Type: text/x-patch, Size: 1044 bytes --]

diff --git a/gold/symtab.cc b/gold/symtab.cc
index cb650fb..d4ac297 100644
--- a/gold/symtab.cc
+++ b/gold/symtab.cc
@@ -310,6 +310,11 @@ Sized_symbol<size>::allocate_common(Output_data* od, Value_type value)
 inline bool
 Symbol::should_add_dynsym_entry(Symbol_table* symtab) const
 {
+  // If the symbol is only present on plugin files, the plugin decided we
+  // don't need it.
+  if (!this->in_real_elf())
+    return false;
+
   // If the symbol is used by a dynamic relocation, we need to add it.
   if (this->needs_dynsym_entry())
     return true;
@@ -2593,6 +2598,15 @@ Symbol_table::sized_finalize_symbol(Symbol* unsized_sym)
       return false;
     }
 
+  // If the symbol is only present on plugin files, the plugin decided we
+  // don't need it.
+  if (!sym->in_real_elf())
+    {
+      gold_assert(!sym->has_symtab_index());
+      sym->set_symtab_index(-1U);
+      return false;
+    }
+
   // Compute final symbol value.
   Compute_final_value_status status;
   Value_type value = this->compute_final_value(sym, &status);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [gold][patch] Don't put symbols dropped by the plugin in the symbol tables
  2011-02-17 20:13 [gold][patch] Don't put symbols dropped by the plugin in the symbol tables Rafael Avila de Espindola
@ 2011-02-18  5:43 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2011-02-18  5:43 UTC (permalink / raw)
  To: Rafael Avila de Espindola; +Cc: binutils

Rafael Avila de Espindola <rafael.espindola@gmail.com> writes:

> 2010-02-17  Rafael Ávila de Espíndola <respindola@mozilla.com>
>
> 	* symtab.cc (Symbol::should_add_dynsym_entry) Return false for
> 	plugin only symbols.
> 	(Symbol_table::sized_finalize_symbol) Mark symbol only present
> 	in plugin files as not needed in the symbol table.

This is OK.

Thanks.

Ian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-18  5:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-17 20:13 [gold][patch] Don't put symbols dropped by the plugin in the symbol tables Rafael Avila de Espindola
2011-02-18  5:43 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).