From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17949 invoked by alias); 11 May 2011 00:30:24 -0000 Received: (qmail 17940 invoked by uid 22791); 11 May 2011 00:30:24 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 May 2011 00:30:10 +0000 Received: from hpaq13.eem.corp.google.com (hpaq13.eem.corp.google.com [172.25.149.13]) by smtp-out.google.com with ESMTP id p4B0U82h000687 for ; Tue, 10 May 2011 17:30:08 -0700 Received: from yxk30 (yxk30.prod.google.com [10.190.3.158]) by hpaq13.eem.corp.google.com with ESMTP id p4B0Ts38008782 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Tue, 10 May 2011 17:30:07 -0700 Received: by yxk30 with SMTP id 30so4922yxk.17 for ; Tue, 10 May 2011 17:30:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.91.199.16 with SMTP id b16mr7102317agq.3.1305073806826; Tue, 10 May 2011 17:30:06 -0700 (PDT) Received: by 10.100.131.8 with HTTP; Tue, 10 May 2011 17:30:06 -0700 (PDT) In-Reply-To: References: <1265843004.2150.342.camel@dp690-dev5v4> <1267053412.6817.190.camel@dp690-dev5v4> Date: Wed, 11 May 2011 00:30:00 -0000 Message-ID: Subject: Re: [GOLD][PATCH PROPOSAL] prevent discarding of needed local symbols for the relocatable objects From: Cary Coutant To: Ian Lance Taylor Cc: vkutuzov@accesssoftek.com, binutils Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-IsSubscribed: yes 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-05/txt/msg00128.txt.bz2 >> This patch fixes the problem. Is this OK, or were you thinking that >> do_finalize_local_symbols() shouldn't even assign the symbol index >> when -s is set? > > I was thinking the latter. =A0I see that do_count_local_symbols checks > discard_locals. =A0It sounds like it should also test strip_all. =A0A pat= ch > for that is preapproved if it works. That works. I've committed the following patch. -cary * object.cc (Sized_relobj::do_count_local_symbols): Check for strip_all (-s). Index: object.cc =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gold/object.cc,v retrieving revision 1.138 diff -u -p -r1.138 object.cc --- object.cc 18 Apr 2011 05:39:43 -0000 1.138 +++ object.cc 11 May 2011 00:25:55 -0000 @@ -1824,6 +1824,7 @@ Sized_relobj::do_count unsigned int dyncount =3D 0; // Skip the first, dummy, symbol. psyms +=3D sym_size; + bool strip_all =3D parameters->options().strip_all(); bool discard_all =3D parameters->options().discard_all(); bool discard_locals =3D parameters->options().discard_locals(); for (unsigned int i =3D 1; i < loccount; ++i, psyms +=3D sym_size) @@ -1882,7 +1883,8 @@ Sized_relobj::do_count ++dyncount; } - if (discard_all && lv.may_be_discarded_from_output_symtab()) + if (strip_all + || (discard_all && lv.may_be_discarded_from_output_symtab())) { lv.set_no_output_symtab_entry(); continue;