Assert size of elf_x86_64_{bnd|legacy}_plt2_entry
authorH.J. Lu <hjl.tools@gmail.com>
Sun, 23 Nov 2014 13:54:02 +0000 (05:54 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Sun, 23 Nov 2014 13:54:02 +0000 (05:54 -0800)
Assert size of elf_x86_64_bnd_plt2_entry and elf_x86_64_legacy_plt2_entry
only in elf_x86_64_check_relocs.

* elf64-x86-64.c (elf_x86_64_check_relocs): Assert size of
elf_x86_64_bnd_plt2_entry and elf_x86_64_legacy_plt2_entry.
(elf_x86_64_allocate_dynrelocs): Don't assert size of
elf_x86_64_bnd_plt2_entry and elf_x86_64_legacy_plt2_entry.

bfd/ChangeLog
bfd/elf64-x86-64.c

index 040576aeef75402e7f21c12894f11d2a0db3488f..ac5e29999379d03e9b9322fe5cd19249cac4dcd0 100644 (file)
@@ -1,3 +1,10 @@
+2014-11-23  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * elf64-x86-64.c (elf_x86_64_check_relocs): Assert size of
+       elf_x86_64_bnd_plt2_entry and elf_x86_64_legacy_plt2_entry.
+       (elf_x86_64_allocate_dynrelocs): Don't assert size of
+       elf_x86_64_bnd_plt2_entry and elf_x86_64_legacy_plt2_entry.
+
 2014-11-22  H.J. Lu  <hongjiu.lu@intel.com>
 
        * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Check
index 8859429ebf1f2d0e20ef2c6d4f73934ec72c659e..66c24e8163feca2d3817109ea7f0eb597a6a6f59 100644 (file)
@@ -1649,17 +1649,10 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
                      const struct elf_backend_data *bed;
 
                      bed = get_elf_backend_data (info->output_bfd);
-                     switch (sizeof (elf_x86_64_bnd_plt2_entry))
-                       {
-                       case 8:
-                         plt_bnd_align = 3;
-                         break;
-                       case 16:
-                         plt_bnd_align = 4;
-                         break;
-                       default:
-                         abort ();
-                       }
+                     BFD_ASSERT (sizeof (elf_x86_64_bnd_plt2_entry) == 8
+                                 && (sizeof (elf_x86_64_bnd_plt2_entry)
+                                     == sizeof (elf_x86_64_legacy_plt2_entry)));
+                     plt_bnd_align = 3;
 
                      if (htab->elf.dynobj == NULL)
                        htab->elf.dynobj = abfd;
@@ -2500,11 +2493,7 @@ elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
          /* Make room for this entry.  */
          s->size += plt_entry_size;
          if (bnd_s)
-           {
-             BFD_ASSERT (sizeof (elf_x86_64_bnd_plt2_entry)
-                         == sizeof (elf_x86_64_legacy_plt2_entry));
-             bnd_s->size += sizeof (elf_x86_64_legacy_plt2_entry);
-           }
+           bnd_s->size += sizeof (elf_x86_64_legacy_plt2_entry);
 
          /* We also need to make an entry in the .got.plt section, which
             will be placed in the .got section by the linker script.  */