comparison src/unexelf.c @ 10995:842974f9ab7d

(unexec): Adjust the file offset of sections located after the section header table.
author Richard M. Stallman <rms@gnu.org>
date Mon, 13 Mar 1995 23:12:41 +0000
parents 401b9dbedc4e
children b322ac77dadc
comparison
equal deleted inserted replaced
10994:d173d21f14e2 10995:842974f9ab7d
717 section address alignment followed the old bss section, so 717 section address alignment followed the old bss section, so
718 this section will be placed in exactly the same place. */ 718 this section will be placed in exactly the same place. */
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. */
730 738
731 PATCH_INDEX (NEW_SECTION_H (nn).sh_link); 739 PATCH_INDEX (NEW_SECTION_H (nn).sh_link);