From patchwork Fri Dec 5 13:00:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lu, Hongjiu" X-Patchwork-Id: 4081 Received: (qmail 30833 invoked by alias); 5 Dec 2014 13:01:57 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 30812 invoked by uid 89); 5 Dec 2014 13:01:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL, BAYES_50, NO_DNS_FOR_FROM, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mga09.intel.com Received: from mga09.intel.com (HELO mga09.intel.com) (134.134.136.24) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 05 Dec 2014 13:01:54 +0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 05 Dec 2014 05:00:37 -0800 X-ExtLoop1: 1 Received: from gnu-6.sc.intel.com ([172.25.70.151]) by orsmga001.jf.intel.com with ESMTP; 05 Dec 2014 05:00:02 -0800 Received: by gnu-6.sc.intel.com (Postfix, from userid 1000) id B0B38200145; Fri, 5 Dec 2014 05:00:02 -0800 (PST) Date: Fri, 5 Dec 2014 05:00:02 -0800 From: "H.J. Lu" To: binutils@sourceware.org, GDB Subject: Re: [PATCH] PR binutils/17677: _bfd_elf_get_synthetic_symtab runs in O(n^2) complexity Message-ID: <20141205130002.GA10539@intel.com> Reply-To: "H.J. Lu" References: <20141205010340.GA29320@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20141205010340.GA29320@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) On Thu, Dec 04, 2014 at 05:03:40PM -0800, H.J. Lu wrote: > In i386 and x86-64 binaries with ifunc, relocations against .got.plt > section may not be in the same order as entries in PLT section. This > patch adds _bfd_elf_ifunc_get_synthetic_symtab. It takes a function > pointer which returns an array of PLT entry symbol values. It calls > the function pointer to get the PLT entry symbol value array indexed > by relocation index, instead of calling plt_sym_val on each relocation > index. > > I checked this patch into master and binutils 2.25 branch. OK for > gdb 7.8 branch? > > Thanks. > > H.J. > --- > PR binutils/17677 > * elf-bfd.h (_bfd_elf_ifunc_get_synthetic_symtab): New prototype. > * elf-ifunc.c (_bfd_elf_ifunc_get_synthetic_symtab): New > function. > * elf32-i386.c (elf_i386_plt_sym_val): Removed. > (elf_backend_plt_sym_val): Likewise. > (elf_i386_get_plt_sym_val): New. > (elf_i386_get_synthetic_symtab): Likewise. > (bfd_elf32_get_synthetic_symtab): Likewise. > * elf64-x86-64.c (elf_x86_64_plt_sym_val): Removed. > (elf_x86_64_plt_sym_val_offset_plt_bnd): Likewise. > (elf_backend_plt_sym_val): Likewise. > (elf_x86_64_get_plt_sym_val): New. > (elf_x86_64_get_synthetic_symtab): Use > _bfd_elf_ifunc_get_synthetic_symtab. > (bfd_elf64_get_synthetic_symtab): Don't undefine for NaCl. > --- > bfd/ChangeLog | 19 +++++ > bfd/elf-bfd.h | 3 + > bfd/elf-ifunc.c | 125 ++++++++++++++++++++++++++++ > bfd/elf32-i386.c | 101 ++++++++++++++++------- > bfd/elf64-x86-64.c | 235 +++++++++++++++++------------------------------------ > 5 files changed, 292 insertions(+), 191 deletions(-) > > diff --git a/bfd/ChangeLog b/bfd/ChangeLog > index 5144eb6..9185b8b 100644 > --- a/bfd/ChangeLog > +++ b/bfd/ChangeLog > @@ -1,3 +1,22 @@ > +2014-12-04 H.J. Lu > + > + PR binutils/17677 > + * elf-bfd.h (_bfd_elf_ifunc_get_synthetic_symtab): New prototype. > + * elf-ifunc.c (_bfd_elf_ifunc_get_synthetic_symtab): New > + function. > + * elf32-i386.c (elf_i386_plt_sym_val): Removed. > + (elf_backend_plt_sym_val): Likewise. > + (elf_i386_get_plt_sym_val): New. > + (elf_i386_get_synthetic_symtab): Likewise. > + (bfd_elf32_get_synthetic_symtab): Likewise. > + * elf64-x86-64.c (elf_x86_64_plt_sym_val): Removed. > + (elf_x86_64_plt_sym_val_offset_plt_bnd): Likewise. > + (elf_backend_plt_sym_val): Likewise. > + (elf_x86_64_get_plt_sym_val): New. > + (elf_x86_64_get_synthetic_symtab): Use > + _bfd_elf_ifunc_get_synthetic_symtab. > + (bfd_elf64_get_synthetic_symtab): Don't undefine for NaCl. > + > 2014-12-04 Alan Modra > I checked this patch into master and 2.25 branch for x32. H.J. diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 9185b8b..d3e211d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,7 @@ +2014-12-05 H.J. Lu + + * elf64-x86-64.c (bfd_elf32_get_synthetic_symtab): New. + 2014-12-04 H.J. Lu PR binutils/17677 diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 710e7ea..64b4634 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -6102,6 +6102,8 @@ elf32_x86_64_nacl_elf_object_p (bfd *abfd) elf_x86_64_reloc_name_lookup #define bfd_elf32_mkobject \ elf_x86_64_mkobject +#define bfd_elf32_get_synthetic_symtab \ + elf_x86_64_get_synthetic_symtab #undef elf_backend_object_p #define elf_backend_object_p \