summaryrefslogtreecommitdiff
path: root/src/unexelf.c
diff options
context:
space:
mode:
authorPhillip Rulon <pjr@gnu.org>1999-10-08 23:08:28 +0000
committerPhillip Rulon <pjr@gnu.org>1999-10-08 23:08:28 +0000
commitf1aba5123374f06e8670874cf3e1d5400025b508 (patch)
tree81c7fcdcc2925ed8b8447ed74116197dff87a18d /src/unexelf.c
parentb02b54a8ba4e958fd103c0ae15874b3010c07860 (diff)
downloademacs-f1aba5123374f06e8670874cf3e1d5400025b508.tar.gz
emacs-f1aba5123374f06e8670874cf3e1d5400025b508.tar.bz2
emacs-f1aba5123374f06e8670874cf3e1d5400025b508.zip
(unexec): Don't get confused by a short section
just before the bss section.
Diffstat (limited to 'src/unexelf.c')
-rw-r--r--src/unexelf.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/unexelf.c b/src/unexelf.c
index 7fa8eb00ce0..015522638f4 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -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