Lines 697-703
unexec (new_name, old_name, data_start,
Link Here
|
697 |
ElfW(Addr) new_data2_addr; |
697 |
ElfW(Addr) new_data2_addr; |
698 |
|
698 |
|
699 |
int n, nn; |
699 |
int n, nn; |
700 |
int old_bss_index, old_sbss_index; |
700 |
int old_bss_index, old_sbss_index, old_plt_index; |
701 |
int old_data_index, new_data2_index; |
701 |
int old_data_index, new_data2_index; |
702 |
int old_mdebug_index; |
702 |
int old_mdebug_index; |
703 |
struct stat stat_buf; |
703 |
struct stat stat_buf; |
Lines 759-770
unexec (new_name, old_name, data_start,
Link Here
|
759 |
if (OLD_SECTION_H (old_sbss_index).sh_type == SHT_PROGBITS) |
759 |
if (OLD_SECTION_H (old_sbss_index).sh_type == SHT_PROGBITS) |
760 |
old_sbss_index = -1; |
760 |
old_sbss_index = -1; |
761 |
|
761 |
|
762 |
if (old_sbss_index == -1) |
762 |
/* PowerPC64 has .plt in the BSS section. */ |
|
|
763 |
old_plt_index = find_section (".plt", old_section_names, |
764 |
old_name, old_file_h, old_section_h, 1); |
765 |
if (old_plt_index != -1) |
766 |
if (OLD_SECTION_H (old_plt_index).sh_type != SHT_NOBITS) |
767 |
old_plt_index = -1; |
768 |
|
769 |
if (old_sbss_index == -1 && old_plt_index == -1) |
763 |
{ |
770 |
{ |
764 |
old_bss_addr = OLD_SECTION_H (old_bss_index).sh_addr; |
771 |
old_bss_addr = OLD_SECTION_H (old_bss_index).sh_addr; |
765 |
old_bss_size = OLD_SECTION_H (old_bss_index).sh_size; |
772 |
old_bss_size = OLD_SECTION_H (old_bss_index).sh_size; |
766 |
new_data2_index = old_bss_index; |
773 |
new_data2_index = old_bss_index; |
767 |
} |
774 |
} |
|
|
775 |
else if (old_plt_index != -1 |
776 |
&& (old_sbss_index == -1 |
777 |
|| (OLD_SECTION_H (old_sbss_index).sh_addr |
778 |
> OLD_SECTION_H (old_plt_index).sh_addr))) |
779 |
{ |
780 |
old_bss_addr = OLD_SECTION_H (old_plt_index).sh_addr; |
781 |
old_bss_size = OLD_SECTION_H (old_bss_index).sh_size |
782 |
+ OLD_SECTION_H (old_plt_index).sh_size; |
783 |
if (old_sbss_index != -1) |
784 |
old_bss_size += OLD_SECTION_H (old_sbss_index).sh_size; |
785 |
new_data2_index = old_plt_index; |
786 |
} |
768 |
else |
787 |
else |
769 |
{ |
788 |
{ |
770 |
old_bss_addr = OLD_SECTION_H (old_sbss_index).sh_addr; |
789 |
old_bss_addr = OLD_SECTION_H (old_sbss_index).sh_addr; |
Lines 955-961
unexec (new_name, old_name, data_start,
Link Here
|
955 |
if (n == old_bss_index |
974 |
if (n == old_bss_index |
956 |
/* The new bss and sbss section's size is zero, and its file offset |
975 |
/* The new bss and sbss section's size is zero, and its file offset |
957 |
and virtual address should be off by NEW_DATA2_SIZE. */ |
976 |
and virtual address should be off by NEW_DATA2_SIZE. */ |
958 |
|| n == old_sbss_index |
977 |
|| n == old_sbss_index || n == old_plt_index |
959 |
) |
978 |
) |
960 |
{ |
979 |
{ |
961 |
/* NN should be `old_s?bss_index + 1' at this point. */ |
980 |
/* NN should be `old_s?bss_index + 1' at this point. */ |
Lines 986-994
unexec (new_name, old_name, data_start,
Link Here
|
986 |
>= OLD_SECTION_H (old_bss_index-1).sh_offset) |
1005 |
>= OLD_SECTION_H (old_bss_index-1).sh_offset) |
987 |
NEW_SECTION_H (nn).sh_offset += new_data2_size; |
1006 |
NEW_SECTION_H (nn).sh_offset += new_data2_size; |
988 |
#else |
1007 |
#else |
989 |
if (round_up (NEW_SECTION_H (nn).sh_offset, |
1008 |
if (NEW_SECTION_H (nn).sh_offset + NEW_SECTION_H (nn).sh_size |
990 |
OLD_SECTION_H (old_bss_index).sh_addralign) |
1009 |
> new_data2_offset) |
991 |
>= new_data2_offset) |
|
|
992 |
NEW_SECTION_H (nn).sh_offset += new_data2_size; |
1010 |
NEW_SECTION_H (nn).sh_offset += new_data2_size; |
993 |
#endif |
1011 |
#endif |
994 |
/* Any section that was originally placed after the section |
1012 |
/* Any section that was originally placed after the section |