]> git.eshelyaron.com Git - emacs.git/commitdiff
(unexec): Don't get confused by a short section
authorPhillip Rulon <pjr@gnu.org>
Fri, 8 Oct 1999 23:08:28 +0000 (23:08 +0000)
committerPhillip Rulon <pjr@gnu.org>
Fri, 8 Oct 1999 23:08:28 +0000 (23:08 +0000)
just before the bss section.

src/unexelf.c

index 7fa8eb00ce0799494f3aa70e3aac80812df2c8bd..015522638f4da017c031704d38b0d5581e5c0bf7 100644 (file)
@@ -926,9 +926,15 @@ unexec (new_name, old_name, data_start, bss_start, entry_address)
              >= OLD_SECTION_H (old_bss_index-1).sh_offset)
            NEW_SECTION_H (nn).sh_offset += new_data2_size;
 #else
-         if (round_up (NEW_SECTION_H (nn).sh_offset,
+         /* The idea of this is that the bss section's sh_offset
+            may need rounding up to compare with new_data2_offset.
+            So we cannot simply compare the sh_offset.
+            However, another small section could exist just before
+            the bss section, and we need to know that is before.  */
+         if (round_up (NEW_SECTION_H (nn).sh_offset
+                       + NEW_SECTION_H (nn).sh_size,
                        OLD_SECTION_H (old_bss_index).sh_addralign)
-             >= new_data2_offset)
+             > new_data2_offset)
            NEW_SECTION_H (nn).sh_offset += new_data2_size;
 #endif
          /* Any section that was originally placed after the section