From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15841 invoked by alias); 17 Feb 2011 20:13:20 -0000 Received: (qmail 15829 invoked by uid 22791); 17 Feb 2011 20:13:16 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_BX,TW_IB,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-iy0-f169.google.com (HELO mail-iy0-f169.google.com) (209.85.210.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 17 Feb 2011 20:13:12 +0000 Received: by iyi20 with SMTP id 20so2864624iyi.0 for ; Thu, 17 Feb 2011 12:13:10 -0800 (PST) Received: by 10.231.206.8 with SMTP id fs8mr2035722ibb.10.1297973589888; Thu, 17 Feb 2011 12:13:09 -0800 (PST) Received: from [10.240.2.241] (corp.tor1.mozilla.com [66.207.206.180]) by mx.google.com with ESMTPS id gy41sm1027732ibb.11.2011.02.17.12.13.08 (version=SSLv3 cipher=OTHER); Thu, 17 Feb 2011 12:13:08 -0800 (PST) Message-ID: <4D5D8153.70009@gmail.com> Date: Thu, 17 Feb 2011 20:13:00 -0000 From: Rafael Avila de Espindola User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 MIME-Version: 1.0 To: binutils@sourceware.org CC: iant@google.com Subject: [gold][patch] Don't put symbols dropped by the plugin in the symbol tables Content-Type: multipart/mixed; boundary="------------030702000307090706010005" Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-02/txt/msg00232.txt.bz2 This is a multi-part message in MIME format. --------------030702000307090706010005 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Content-length: 577 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 * 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 --------------030702000307090706010005 Content-Type: text/x-patch; name="symtab.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="symtab.patch" Content-length: 1044 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::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); --------------030702000307090706010005--