This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] PR binutils/17677: _bfd_elf_get_synthetic_symtab runs in O(n^2) complexity
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sourceware dot org, GDB <gdb-patches at sourceware dot org>
- Date: Fri, 5 Dec 2014 05:00:02 -0800
- Subject: Re: [PATCH] PR binutils/17677: _bfd_elf_get_synthetic_symtab runs in O(n^2) complexity
- Authentication-results: sourceware.org; auth=none
- References: <20141205010340 dot GA29320 at intel dot com>
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
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 <hongjiu.lu@intel.com>
> +
> + 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 <amodra@gmail.com>
>
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 <hongjiu.lu@intel.com>
+
+ * elf64-x86-64.c (bfd_elf32_get_synthetic_symtab): New.
+
2014-12-04 H.J. Lu <hongjiu.lu@intel.com>
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 \