From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25609 invoked by alias); 11 Apr 2005 14:44:06 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 25339 invoked from network); 11 Apr 2005 14:43:58 -0000 Received: from unknown (HELO gizmo04bw.bigpond.com) (144.140.70.14) by sourceware.org with SMTP; 11 Apr 2005 14:43:58 -0000 Received: (qmail 27438 invoked from network); 11 Apr 2005 14:43:56 -0000 Received: from unknown (HELO bwmam12.bigpond.com) (144.135.24.103) by gizmo04bw.bigpond.com with SMTP; 11 Apr 2005 14:43:56 -0000 Received: from cpe-144-136-221-26.sa.bigpond.net.au ([144.136.221.26]) by bwmam12.bigpond.com(MAM REL_3_4_2a 189/54147961) with SMTP id 54147961; Tue, 12 Apr 2005 00:43:56 +1000 Received: by bubble.modra.org (Postfix, from userid 500) id 894081A094F; Tue, 12 Apr 2005 00:13:56 +0930 Date: Mon, 11 Apr 2005 14:44:00 -0000 From: Alan Modra To: "H. J. Lu" Cc: binutils@sources.redhat.com Subject: Re: [hjl@lucon.org: Re: your patch to remove unused sections] Message-ID: <20050411144356.GC861@bubble.modra.org> Mail-Followup-To: "H. J. Lu" , binutils@sources.redhat.com References: <20050411140930.GA14672@lucon.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050411140930.GA14672@lucon.org> User-Agent: Mutt/1.4i X-SW-Source: 2005-04/txt/msg00238.txt.bz2 On Mon, Apr 11, 2005 at 07:09:30AM -0700, H. J. Lu wrote: > Hi Alan, > > Have you looked at this patch? Yes, I was going to ask for a revision, but wanted to check whether my idea was feasible before asking you to make a change, which would remove the following loop: > + /* .bss and similar sections won't have the linker_mark > + field set. We have to check if its output section is > + included in output_bfd. */ > + for (sec = output_bfd->sections; sec != NULL; sec = sec->next) > + if (sec == sym->section->output_section) > + break; I haven't had time to check, but here's the idea anyway: After removing an unused output section s with bfd_section_list_remove (output_bfd, s), clear s->next. Then if (sym->section->output_section->next == NULL && *output_bfd->section_tail != sym->section->output_section) { /* The section has been removed. */ } -- Alan Modra IBM OzLabs - Linux Technology Centre