From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8788 invoked by alias); 20 Mar 2005 05:49:55 -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 8725 invoked from network); 20 Mar 2005 05:49:48 -0000 Received: from unknown (HELO omta05ps.mx.bigpond.com) (144.140.83.195) by sourceware.org with SMTP; 20 Mar 2005 05:49:48 -0000 Received: from modra.org ([144.136.221.26]) by omta05ps.mx.bigpond.com with ESMTP id <20050320054946.EYSG18880.omta05ps.mx.bigpond.com@modra.org>; Sun, 20 Mar 2005 05:49:46 +0000 Received: by bubble.modra.org (Postfix, from userid 500) id 44C8719FDAC; Sun, 20 Mar 2005 16:19:46 +1030 (CST) Date: Sun, 20 Mar 2005 13:22:00 -0000 From: Alan Modra To: "H. J. Lu" Cc: binutils@sources.redhat.com Subject: Re: PATCH: Store ELF section index for input file Message-ID: <20050320054946.GN21148@bubble.modra.org> Mail-Followup-To: "H. J. Lu" , binutils@sources.redhat.com References: <20050317195051.GA9484@lucon.org> <20050317205827.GA10787@lucon.org> <20050319094400.GI21148@bubble.modra.org> <20050319175700.GA19299@lucon.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050319175700.GA19299@lucon.org> User-Agent: Mutt/1.4i X-SW-Source: 2005-03/txt/msg00587.txt.bz2 On Sat, Mar 19, 2005 at 09:57:01AM -0800, H. J. Lu wrote: > On Sat, Mar 19, 2005 at 08:14:00PM +1030, Alan Modra wrote: > > On Thu, Mar 17, 2005 at 12:58:27PM -0800, H. J. Lu wrote: > > > @@ -4823,9 +4830,16 @@ _bfd_elf_section_from_bfd_section (bfd * > > > const struct elf_backend_data *bed; > > > int index; > > > > > > - if (elf_section_data (asect) != NULL > > > - && elf_section_data (asect)->this_idx != 0) > > > - return elf_section_data (asect)->this_idx; > > > + if (elf_section_data (asect) != NULL) > > > + { > > > + index = elf_section_data (asect)->this_idx; > > > + if (index != 0) > > > + { > > > + Elf_Internal_Shdr **i_shdrp = elf_elfsections (abfd); > > > + if (!i_shdrp || i_shdrp [index]->bfd_section == asect) > > > + return index; > > > + } > > > + } > > > > Please explain why this change is necessary. > > > > _bfd_elf_section_from_bfd_section is called on input sections. When > there are more than 64K input sections, linear search over a linked > list can be very very slow. Since this_idx isn't used for input section > and for input section, its bfd section is created from its ELF > section index, we can use this_idx to store the ELF section index. The > result is the linking time went from No, I meant why that particular hunk. You first posted a patch without it, then just said it was needed, but not why. > 966.01s user 0.81s system 99% cpu 16:06.87 total > > to > > 45.61s user 0.81s system 99% cpu 46.448 total > > It is 20X speed up. I tested it with Linux kernel, binutils, gcc and > glibc on ia32, ia64 and x86_64. There are no regressions. > > BTW, it only solves the 64K input section problem. The 64K output > sections is still very slow. bfd_section has a pointer to its BFD > owner. Can we add a pointer to bfd_section, used_by_ld, which will > be used by ld for lang_output_section_statement_type? I think it might be worth investigating a larger change, not creating lang_output_section_statemtents for orphans. I'll look at this some time when I have a free moment or two. -- Alan Modra IBM OzLabs - Linux Technology Centre