/[emacs]/emacs/src/unexelf.c
ViewVC logotype

Diff of /emacs/src/unexelf.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.59 by eliz, Thu Oct 20 13:59:31 2005 UTC revision 1.60 by schwab, Tue Nov 1 21:32:27 2005 UTC
# Line 682  unexec (new_name, old_name, data_start, Line 682  unexec (new_name, old_name, data_start,
682    ElfW(Addr) new_data2_addr;    ElfW(Addr) new_data2_addr;
683    
684    int n, nn;    int n, nn;
685    int old_bss_index, old_sbss_index;    int old_bss_index, old_sbss_index, old_plt_index;
686    int old_data_index, new_data2_index;    int old_data_index, new_data2_index;
687    int old_mdebug_index;    int old_mdebug_index;
688    struct stat stat_buf;    struct stat stat_buf;
# Line 740  unexec (new_name, old_name, data_start, Line 740  unexec (new_name, old_name, data_start,
740    old_sbss_index = find_section (".sbss", old_section_names,    old_sbss_index = find_section (".sbss", old_section_names,
741                                   old_name, old_file_h, old_section_h, 1);                                   old_name, old_file_h, old_section_h, 1);
742    if (old_sbss_index != -1)    if (old_sbss_index != -1)
743      if (OLD_SECTION_H (old_sbss_index).sh_type == SHT_PROGBITS)      if (OLD_SECTION_H (old_sbss_index).sh_type != SHT_NOBITS)
744        old_sbss_index = -1;        old_sbss_index = -1;
745    
746    if (old_sbss_index == -1)    /* PowerPC64 has .plt in the BSS section.  */
747      old_plt_index = find_section (".plt", old_section_names,
748                                    old_name, old_file_h, old_section_h, 1);
749      if (old_plt_index != -1)
750        if (OLD_SECTION_H (old_plt_index).sh_type != SHT_NOBITS)
751          old_plt_index = -1;
752    
753      if (old_sbss_index == -1 && old_plt_index == -1)
754      {      {
755        old_bss_addr = OLD_SECTION_H (old_bss_index).sh_addr;        old_bss_addr = OLD_SECTION_H (old_bss_index).sh_addr;
756        old_bss_size = OLD_SECTION_H (old_bss_index).sh_size;        old_bss_size = OLD_SECTION_H (old_bss_index).sh_size;
757        new_data2_index = old_bss_index;        new_data2_index = old_bss_index;
758      }      }
759      else if (old_plt_index != -1
760               && (old_sbss_index == -1
761                   || (OLD_SECTION_H (old_sbss_index).sh_addr
762                       > OLD_SECTION_H (old_plt_index).sh_addr)))
763        {
764          old_bss_addr = OLD_SECTION_H (old_plt_index).sh_addr;
765          old_bss_size = OLD_SECTION_H (old_bss_index).sh_size
766            + OLD_SECTION_H (old_plt_index).sh_size;
767          if (old_sbss_index != -1)
768            old_bss_size += OLD_SECTION_H (old_sbss_index).sh_size;
769          new_data2_index = old_plt_index;
770        }
771    else    else
772      {      {
773        old_bss_addr = OLD_SECTION_H (old_sbss_index).sh_addr;        old_bss_addr = OLD_SECTION_H (old_sbss_index).sh_addr;
# Line 934  unexec (new_name, old_name, data_start, Line 953  unexec (new_name, old_name, data_start,
953        if (n == old_bss_index        if (n == old_bss_index
954            /* The new bss and sbss section's size is zero, and its file offset            /* The new bss and sbss section's size is zero, and its file offset
955               and virtual address should be off by NEW_DATA2_SIZE.  */               and virtual address should be off by NEW_DATA2_SIZE.  */
956            || n == old_sbss_index            || n == old_sbss_index || n == old_plt_index
957            )            )
958          {          {
959            /* NN should be `old_s?bss_index + 1' at this point. */            /* NN should be `old_s?bss_index + 1' at this point. */

Legend:
Removed from v.1.59  
changed lines
  Added in v.1.60

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26