/[gcl]/gcl/o/unexelf.c
ViewVC logotype

Diff of /gcl/o/unexelf.c

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

revision 1.5 by camm, Thu Jan 31 19:17:47 2002 UTC revision 1.6 by camm, Sat Jul 20 07:10:56 2002 UTC
# Line 398  Filesz      Memsz       Flags       Alig Line 398  Filesz      Memsz       Flags       Alig
398   */   */
399    
400  #ifndef emacs  #ifndef emacs
401  #define fatal(a, b, c...) fprintf (stderr, a, b, ##c), exit (1)  #define fatal(a, b...) fprintf (stderr, a, ##b), exit (1)
402  #else  #else
403  #include "config.h"  #include "config.h"
404  extern void fatal (char *, ...);  extern void fatal (char *, ...);
# Line 581  round_up (x, y) Line 581  round_up (x, y)
581     if NOERROR is 0; we return -1 if NOERROR is nonzero.  */     if NOERROR is 0; we return -1 if NOERROR is nonzero.  */
582    
583  static int  static int
584  find_section (name, section_names, file_name, old_file_h, old_section_h, noerror)  find_section (char *name, char *section_names, char *file_name, Elf32_Ehdr *old_file_h, Elf32_Shdr *old_section_h, int noerror)
      char *name;  
      char *section_names;  
      char *file_name;  
      ElfW(Ehdr) *old_file_h;  
      ElfW(Shdr) *old_section_h;  
      int noerror;  
585  {  {
586    int idx;    int idx;
587    
# Line 606  find_section (name, section_names, file_ Line 600  find_section (name, section_names, file_
600        if (noerror)        if (noerror)
601          return -1;          return -1;
602        else        else
603          fatal ("Can't find %s in %s.\n", name, file_name, 0);          fatal ("Can't find %s in %s.\n", name, file_name);
604      }      }
605    
606    return idx;    return idx;
# Line 622  find_section (name, section_names, file_ Line 616  find_section (name, section_names, file_
616   *   *
617   */   */
618  void  void
619  unexec (new_name, old_name, data_start, bss_start, entry_address)  unexec (char *new_name, char *old_name, unsigned int data_start, unsigned int bss_start, unsigned int entry_address)
      char *new_name, *old_name;  
      unsigned data_start, bss_start, entry_address;  
620  {  {
621    int new_file, old_file, new_file_size;    int new_file, old_file, new_file_size;
622    
# Line 740  unexec (new_name, old_name, data_start, Line 732  unexec (new_name, old_name, data_start,
732  #endif  #endif
733    
734    if ((unsigned) new_bss_addr < (unsigned) old_bss_addr + old_bss_size)    if ((unsigned) new_bss_addr < (unsigned) old_bss_addr + old_bss_size)
735      fatal (".bss shrank when undumping???\n", 0, 0);      fatal (".bss shrank when undumping???\n");
736    
737    /* Set the output file to the right size and mmap it.  Set    /* Set the output file to the right size and mmap it.  Set
738     * pointers to various interesting objects.  stat_buf still has     * pointers to various interesting objects.  stat_buf still has
# Line 823  unexec (new_name, old_name, data_start, Line 815  unexec (new_name, old_name, data_start,
815            > (old_sbss_index == -1            > (old_sbss_index == -1
816               ? old_bss_addr               ? old_bss_addr
817               : round_up (old_bss_addr, alignment)))               : round_up (old_bss_addr, alignment)))
818            fatal ("Program segment above .bss in %s\n", old_name, 0);            fatal ("Program segment above .bss in %s\n", old_name);
819    
820        if (NEW_PROGRAM_H (n).p_type == PT_LOAD        if (NEW_PROGRAM_H (n).p_type == PT_LOAD
821            && (round_up ((NEW_PROGRAM_H (n)).p_vaddr            && (round_up ((NEW_PROGRAM_H (n)).p_vaddr
# Line 833  unexec (new_name, old_name, data_start, Line 825  unexec (new_name, old_name, data_start,
825          break;          break;
826      }      }
827    if (n < 0)    if (n < 0)
828      fatal ("Couldn't find segment next to .bss in %s\n", old_name, 0);      fatal ("Couldn't find segment next to .bss in %s\n", old_name);
829    
830    /* Make sure that the size includes any padding before the old .bss    /* Make sure that the size includes any padding before the old .bss
831       section.  */       section.  */
# Line 864  unexec (new_name, old_name, data_start, Line 856  unexec (new_name, old_name, data_start,
856                   ".data"))                   ".data"))
857        break;        break;
858    if (old_data_index == old_file_h->e_shnum)    if (old_data_index == old_file_h->e_shnum)
859      fatal ("Can't find .data in %s.\n", old_name, 0);      fatal ("Can't find .data in %s.\n", old_name);
860    
861    /* Walk through all section headers, insert the new data2 section right    /* Walk through all section headers, insert the new data2 section right
862       before the new bss section. */       before the new bss section. */

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

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