* elfcode.h (elf_sort_hdrs): Check SHT_NOBITS before checking
authorIan Lance Taylor <ian@airs.com>
Tue, 7 Mar 1995 17:25:07 +0000 (17:25 +0000)
committerIan Lance Taylor <ian@airs.com>
Tue, 7 Mar 1995 17:25:07 +0000 (17:25 +0000)
sh_size.

bfd/ChangeLog
bfd/elfcode.h

index fee1f1776c6a7e9cd15c17a627052db388e459f5..8702af818e0b32905eab8d769645b6afdee8063c 100644 (file)
@@ -1,3 +1,8 @@
+Tue Mar  7 12:23:47 1995  Ian Lance Taylor  <ian@cygnus.com>
+
+       * elfcode.h (elf_sort_hdrs): Check SHT_NOBITS before checking
+       sh_size.
+
 Mon Mar  6 23:31:36 1995  Doug Evans  <dje@chestnut.cygnus.com>
 
        * elfcode.h (elf_sort_hdrs): Keep SHT_NOBITS sections after
index 72908ca582a4959b3ec1c1745c33fde070417ad8..1766909124da6d69e74e3864e280325c4b3087c7 100644 (file)
@@ -2261,28 +2261,24 @@ elf_sort_hdrs (arg1, arg2)
 
   if ((hdr1->sh_flags & SHF_ALLOC) != 0)
     {
+      int ret;
+
       if ((hdr2->sh_flags & SHF_ALLOC) == 0)
        return -1;
       if (hdr1->sh_addr < hdr2->sh_addr)
        return -1;
       else if (hdr1->sh_addr > hdr2->sh_addr)
        return 1;
+      /* Put !SHT_NOBITS sections before SHT_NOBITS ones.
+         The main loop in map_program_segments requires this. */
+      ret = (hdr1->sh_type == SHT_NOBITS) - (hdr2->sh_type == SHT_NOBITS);
+      if (ret != 0)
+       return ret;
       if (hdr1->sh_size == 0)
-       {
-         if (hdr2->sh_size == 0)
-           {
-             /* Put !SHT_NOBITS sections before SHT_NOBITS ones.
-                The main loop in map_program_segments requires this. */
-             return (hdr1->sh_type == SHT_NOBITS) - (hdr2->sh_type == SHT_NOBITS);
-           }
-         else
-           return -1;
-       }
+       return -1;
       else if (hdr2->sh_size == 0)
        return 1;
-      /* Put !SHT_NOBITS sections before SHT_NOBITS ones.
-         The main loop in map_program_segments requires this. */
-      return (hdr1->sh_type == SHT_NOBITS) - (hdr2->sh_type == SHT_NOBITS);
+      return 0;
     }
   else
     {