aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2014-11-23 05:54:02 -0800
committerH.J. Lu <hjl.tools@gmail.com>2014-11-23 05:54:02 -0800
commit6db50b4cfe55834ee5fc8dc95c80529f8a0f2a1f (patch)
treefd6d61d3876e6b4bdc0fdb6ae91d02f5a44de8e6
parente8af5d7a5cd4c58136a4733e87612f49061bf28b (diff)
downloadgdb-6db50b4cfe55834ee5fc8dc95c80529f8a0f2a1f.zip
gdb-6db50b4cfe55834ee5fc8dc95c80529f8a0f2a1f.tar.gz
gdb-6db50b4cfe55834ee5fc8dc95c80529f8a0f2a1f.tar.bz2
Assert size of elf_x86_64_{bnd|legacy}_plt2_entry
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.
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elf64-x86-64.c21
2 files changed, 12 insertions, 16 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 040576a..ac5e299 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 8859429..66c24e8 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -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. */