diff options
| author | Richard M. Stallman | 1995-03-13 23:12:41 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-03-13 23:12:41 +0000 |
| commit | 85b2e0ee8874a5c770f506f1aef89d589d83e2ac (patch) | |
| tree | 7548302b8abad12efb238e538c381717dd0e2a3d /src | |
| parent | 4c0b5ad1cba82d3e8dbc16d86cdb897e22be955c (diff) | |
| download | emacs-85b2e0ee8874a5c770f506f1aef89d589d83e2ac.tar.gz emacs-85b2e0ee8874a5c770f506f1aef89d589d83e2ac.zip | |
(unexec): Adjust the file offset of sections located
after the section header table.
Diffstat (limited to 'src')
| -rw-r--r-- | src/unexelf.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/unexelf.c b/src/unexelf.c index 0277f5767ab..5ce8050dcc8 100644 --- a/src/unexelf.c +++ b/src/unexelf.c | |||
| @@ -719,11 +719,19 @@ unexec (new_name, old_name, data_start, bss_start, entry_address) | |||
| 719 | NEW_SECTION_H (nn).sh_addralign = OLD_SECTION_H (nn).sh_addralign; | 719 | NEW_SECTION_H (nn).sh_addralign = OLD_SECTION_H (nn).sh_addralign; |
| 720 | NEW_SECTION_H (nn).sh_size = 0; | 720 | NEW_SECTION_H (nn).sh_size = 0; |
| 721 | } | 721 | } |
| 722 | /* Any section that was original placed AFTER the bss section should now | 722 | else |
| 723 | be off by NEW_DATA2_SIZE. */ | 723 | { |
| 724 | else if (NEW_SECTION_H (nn).sh_offset >= new_data2_offset) | 724 | /* Any section that was original placed AFTER the bss |
| 725 | NEW_SECTION_H (nn).sh_offset += new_data2_size; | 725 | section should now be off by NEW_DATA2_SIZE. */ |
| 726 | 726 | if (NEW_SECTION_H (nn).sh_offset >= new_data2_offset) | |
| 727 | NEW_SECTION_H (nn).sh_offset += new_data2_size; | ||
| 728 | /* Any section that was originally placed after the section | ||
| 729 | header table should now be off by the size of one section | ||
| 730 | header table entry. */ | ||
| 731 | if (NEW_SECTION_H (nn).sh_offset > new_file_h->e_shoff) | ||
| 732 | NEW_SECTION_H (nn).sh_offset += new_file_h->e_shentsize; | ||
| 733 | } | ||
| 734 | |||
| 727 | /* If any section hdr refers to the section after the new .data | 735 | /* If any section hdr refers to the section after the new .data |
| 728 | section, make it refer to next one because we have inserted | 736 | section, make it refer to next one because we have inserted |
| 729 | a new section in between. */ | 737 | a new section in between. */ |