This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] MIPS/BFD: Fix assertion in `mips_elf_sort_hash_table'
- From: Maciej W.Rozycki <macro at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 2 Feb 2017 22:41:36 -0000
- Subject: [binutils-gdb] MIPS/BFD: Fix assertion in `mips_elf_sort_hash_table'
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=17a80fa80adbe79df39ba1fc70e611dff92df197
commit 17a80fa80adbe79df39ba1fc70e611dff92df197
Author: Maciej W. Rozycki <macro@imgtec.com>
Date: Thu Feb 2 20:53:16 2017 +0000
MIPS/BFD: Fix assertion in `mips_elf_sort_hash_table'
Move the assertion on non-NULL `htab' in `mips_elf_sort_hash_table' to
the beginning, before the pointer is dereferenced (`mips_elf_hash_table
(info)' and `elf_hash_table (info)' both point to the same memory
location, differently typed).
bfd/
* elfxx-mips.c (mips_elf_sort_hash_table): Move assertion on
non-NULL `htab' to the beginning.
Diff:
---
bfd/ChangeLog | 5 +++++
bfd/elfxx-mips.c | 6 +++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 62a3fea..fca45ac 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
2017-02-02 Maciej W. Rozycki <macro@imgtec.com>
+ * elfxx-mips.c (mips_elf_sort_hash_table): Move assertion on
+ non-NULL `htab' to the beginning.
+
+2017-02-02 Maciej W. Rozycki <macro@imgtec.com>
+
* elflink.c (elf_gc_sweep): Wrap overlong line.
2017-01-30 Maciej W. Rozycki <macro@imgtec.com>
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index bda02b1..d1c0f80 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -3832,12 +3832,12 @@ mips_elf_sort_hash_table (bfd *abfd, struct bfd_link_info *info)
struct mips_elf_hash_sort_data hsd;
struct mips_got_info *g;
- if (elf_hash_table (info)->dynsymcount == 0)
- return TRUE;
-
htab = mips_elf_hash_table (info);
BFD_ASSERT (htab != NULL);
+ if (elf_hash_table (info)->dynsymcount == 0)
+ return TRUE;
+
g = htab->got_info;
if (g == NULL)
return TRUE;