]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
MIPS/BFD: Fix assertion in `mips_elf_sort_hash_table'
authorMaciej W. Rozycki <macro@imgtec.com>
Thu, 2 Feb 2017 20:53:16 +0000 (20:53 +0000)
committerMaciej W. Rozycki <macro@imgtec.com>
Mon, 13 Feb 2017 14:27:41 +0000 (14:27 +0000)
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.

(cherry picked from commit 17a80fa80adbe79df39ba1fc70e611dff92df197)

bfd/ChangeLog
bfd/elfxx-mips.c

index 244d1904333227e6f221d983164075645498431d..8a594e48ff931dd2cfd38ab817b22c399ca6a520 100644 (file)
@@ -1,3 +1,8 @@
+2017-02-13  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-03  Alan Modra  <amodra@gmail.com>
 
        * elf32-hppa.c (ensure_undef_weak_dynamic): New function.
index bda02b128ec0eee9ec35be47a327958ef528c8c5..d1c0f804168b38b90ac8753f764639f68a135a12 100644 (file)
@@ -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;