]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
x86: Add VERIFY_PLT_ENTRY
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 6 Oct 2017 07:46:56 +0000 (00:46 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 6 Oct 2017 07:48:26 +0000 (00:48 -0700)
Add VERIFY_PLT_ENTRY to verify that symbol has an entry in the procedure
linkage table.

* elfxx-x86.h (VERIFY_PLT_ENTRY): New.
* elf32-i386.c (elf_i386_finish_dynamic_symbol): Use it.
* elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.

bfd/ChangeLog
bfd/elf32-i386.c
bfd/elf64-x86-64.c
bfd/elfxx-x86.h

index 6f2f9a268bed8ab1a1ef54cdbe426ea162aac2f9..2ad9e423f0cae190db843ac7522dc25a54b07578 100644 (file)
@@ -1,3 +1,9 @@
+2017-10-06  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * elfxx-x86.h (VERIFY_PLT_ENTRY): New.
+       * elf32-i386.c (elf_i386_finish_dynamic_symbol): Use it.
+       * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
+
 2017-10-06  H.J. Lu  <hongjiu.lu@intel.com>
 
        * elfxx-x86.h (COPY_INPUT_RELOC_P): New.
index 4adb70a0c5c153ef176a6e87541666a223d1c9d2..822fe4f9dc409d1faa2a96a5d38f7feab5cd7154 100644 (file)
@@ -3577,18 +3577,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
          relplt = htab->elf.irelplt;
        }
 
-      /* This symbol has an entry in the procedure linkage table.  Set
-        it up.  */
-
-      if ((h->dynindx == -1
-          && !local_undefweak
-          && !((h->forced_local || bfd_link_executable (info))
-               && h->def_regular
-               && h->type == STT_GNU_IFUNC))
-         || plt == NULL
-         || gotplt == NULL
-         || relplt == NULL)
-       abort ();
+      VERIFY_PLT_ENTRY (info, h, plt, gotplt, relplt, local_undefweak)
 
       /* Get the index in the procedure linkage table which
         corresponds to this symbol.  This is the index of this symbol
index fcc7f5574ea7f28ce69032574a832611562d43b3..1fb0a2deaf1bde66ea24550a7561b434926f071c 100644 (file)
@@ -3939,17 +3939,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
          relplt = htab->elf.irelplt;
        }
 
-      /* This symbol has an entry in the procedure linkage table.  Set
-        it up.  */
-      if ((h->dynindx == -1
-          && !local_undefweak
-          && !((h->forced_local || bfd_link_executable (info))
-               && h->def_regular
-               && h->type == STT_GNU_IFUNC))
-         || plt == NULL
-         || gotplt == NULL
-         || relplt == NULL)
-       abort ();
+      VERIFY_PLT_ENTRY (info, h, plt, gotplt, relplt, local_undefweak)
 
       /* Get the index in the procedure linkage table which
         corresponds to this symbol.  This is the index of this symbol
index be438c08a38951baff624939c2f46b171b676d3b..b81e1455398357809363f8b32d7f7259819cbc27 100644 (file)
    && (H)->dynindx == -1 \
    && (TLS_TYPE & GOT_TLS_IE))
 
+/* Verify that the symbol has an entry in the procedure linkage table.  */
+#define VERIFY_PLT_ENTRY(INFO, H, PLT, GOTPLT, RELPLT, LOCAL_UNDEFWEAK) \
+  if (((H)->dynindx == -1 \
+       && !LOCAL_UNDEFWEAK \
+       && !(((H)->forced_local || bfd_link_executable (INFO)) \
+           && (H)->def_regular \
+           && (H)->type == STT_GNU_IFUNC)) \
+      || (PLT) == NULL \
+      || (GOTPLT) == NULL \
+      || (RELPLT) == NULL) \
+    abort ();
+
 /* x86 ELF linker hash entry.  */
 
 struct elf_x86_link_hash_entry