Add _bfd_elf_ifunc_get_synthetic_symtab
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 4 Dec 2014 22:19:41 +0000 (14:19 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 5 Dec 2014 00:58:42 +0000 (16:58 -0800)
commit875896e3e6880ec4c27b4fdfc37ae44881e11ca8
treebd8ef60e3225f28418e3964f2bc80a2367bb3d29
parentf6989d5268fbd213d889e3d81f8972dd429b1bbf
Add _bfd_elf_ifunc_get_synthetic_symtab

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.

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
bfd/elf-bfd.h
bfd/elf-ifunc.c
bfd/elf32-i386.c
bfd/elf64-x86-64.c