This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RFC: Use .plt section sh_entsize instead of GET_PLT_ENTRY_SIZE
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: GDB <gdb-patches at sourceware dot org>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Fri, 9 Aug 2013 10:16:18 -0700
- Subject: RFC: Use .plt section sh_entsize instead of GET_PLT_ENTRY_SIZE
Hi,
We need to increase x86-64 PLT entry size to 32 bytes to
support Intel MPX. But elf_x86_64_plt_sym_val uses the
hardcoded PLT entry size and disassembler can't deal
with a different PLT entry size. For x86-64, PLT entry size
is the same as .plt section sh_entsize. We can use it instead.
This assumes .sh_entsize is set correctly. Both ld and gold
handle it properly. Will this change cause any problems?
Thanks.
--
H.J.
--
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 56a1f81..ff69af8 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -4922,7 +4922,7 @@ static bfd_vma
elf_x86_64_plt_sym_val (bfd_vma i, const asection *plt,
const arelent *rel ATTRIBUTE_UNUSED)
{
- return plt->vma + (i + 1) * GET_PLT_ENTRY_SIZE (plt->owner);
+ return plt->vma + (i + 1) * elf_section_data (plt)->this_hdr.sh_entsize;
}
/* Handle an x86-64 specific section when reading an object file. This