aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-i386.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-08-23 13:12:04 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-08-23 13:12:04 -0700
commitb1bb697ea1259c0977c38f1ec5f2239cbe669869 (patch)
tree73987243f9dd473e2187686e33c0beda4208b086 /bfd/elf32-i386.c
parent73784fa565bd66f1ac165816c03e5217b7d67bbc (diff)
downloadfsf-binutils-gdb-b1bb697ea1259c0977c38f1ec5f2239cbe669869.zip
fsf-binutils-gdb-b1bb697ea1259c0977c38f1ec5f2239cbe669869.tar.gz
fsf-binutils-gdb-b1bb697ea1259c0977c38f1ec5f2239cbe669869.tar.bz2
x86: Increment PLT count only for function symbols
Since PLT entry is needed only for function symbols, increment PLT count only for function symbols. * elf32-i386.c (elf_i386_check_relocs): Increment PLT count only for function symbols. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r--bfd/elf32-i386.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 1009c17..ae23752 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -2273,8 +2273,9 @@ do_relocation:
/* We may need a .plt entry if the symbol is a function
defined in a shared lib or is a STT_GNU_IFUNC function
referenced from the code or read-only section. */
- if (!h->def_regular
- || (sec->flags & (SEC_CODE | SEC_READONLY)) != 0)
+ if ((h->type == STT_FUNC || h->type == STT_GNU_IFUNC)
+ && (!h->def_regular
+ || (sec->flags & (SEC_CODE | SEC_READONLY)) != 0))
h->plt.refcount += 1;
if (r_type == R_386_PC32)