From: H.J. Lu Date: Wed, 16 Jul 2014 18:15:56 +0000 (-0700) Subject: Match PLT entry only for ELFOSABI_GNU input X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cca5b8b64b3286bb96cd7a2c18232d1acea85cd9;p=binutils-gdb.git Match PLT entry only for ELFOSABI_GNU input * elf32-i386.c (elf_i386_plt_sym_val): Match PLT entry only for ELFOSABI_GNU input. * elf64-x86-64.c (elf_x86_64_plt_sym_val): Likewise. (elf_x86_64_plt_sym_val_offset_plt_bnd): Likewise. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 5e9ce0f243a..9be9b8cfbbb 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2014-07-16 H.J. Lu + + * elf32-i386.c (elf_i386_plt_sym_val): Match PLT entry only for + ELFOSABI_GNU input. + * elf64-x86-64.c (elf_x86_64_plt_sym_val): Likewise. + (elf_x86_64_plt_sym_val_offset_plt_bnd): Likewise. + 2014-07-16 H.J. Lu PR binutils/17154 diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index aa01a7a9003..7c4b4bb918d 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -4994,6 +4994,10 @@ elf_i386_plt_sym_val (bfd_vma i, const asection *plt, const arelent *rel) abfd = plt->owner; bed = get_elf_i386_backend_data (abfd); plt_offset = bed->plt->plt_entry_size; + + if (elf_elfheader (abfd)->e_ident[EI_OSABI] != ELFOSABI_GNU) + return plt->vma + (i + 1) * plt_offset; + while (plt_offset < plt->size) { bfd_vma reloc_offset; diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 5eea8105f33..f71291e87fa 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -5311,6 +5311,10 @@ elf_x86_64_plt_sym_val (bfd_vma i, const asection *plt, abfd = plt->owner; bed = get_elf_x86_64_backend_data (abfd); plt_offset = bed->plt_entry_size; + + if (elf_elfheader (abfd)->e_ident[EI_OSABI] != ELFOSABI_GNU) + return plt->vma + (i + 1) * plt_offset; + while (plt_offset < plt->size) { bfd_vma reloc_index; @@ -5340,6 +5344,10 @@ elf_x86_64_plt_sym_val_offset_plt_bnd (bfd_vma i, const asection *plt) const struct elf_x86_64_backend_data *bed = &elf_x86_64_bnd_arch_bed; bfd *abfd = plt->owner; bfd_vma plt_offset = bed->plt_entry_size; + + if (elf_elfheader (abfd)->e_ident[EI_OSABI] != ELFOSABI_GNU) + return i * sizeof (elf_x86_64_legacy_plt2_entry); + while (plt_offset < plt->size) { bfd_vma reloc_index;