comparison src/unexec.c @ 647:b39c14581166

[xemacs-hg @ 2001-08-13 04:45:47 by ben] removal of unsigned, size_t, etc.
author ben
date Mon, 13 Aug 2001 04:46:48 +0000
parents 183866b06e0b
children 943eaba38521
comparison
equal deleted inserted replaced
646:00c54252fe4f 647:b39c14581166
708 708
709 /* Get symbol table info from header of a.out file if given one. */ 709 /* Get symbol table info from header of a.out file if given one. */
710 if (a_out >= 0) 710 if (a_out >= 0)
711 { 711 {
712 #ifdef COFF_ENCAPSULATE 712 #ifdef COFF_ENCAPSULATE
713 if (read (a_out, &coffheader, sizeof coffheader) != sizeof coffheader) 713 if (read (a_out, &coffheader, sizeof (coffheader)) != sizeof (coffheader))
714 { 714 {
715 PERROR(a_name); 715 PERROR(a_name);
716 } 716 }
717 if (coffheader.f_magic != COFF_MAGIC) 717 if (coffheader.f_magic != COFF_MAGIC)
718 { 718 {
719 ERROR1("%s doesn't have legal coff magic number\n", a_name); 719 ERROR1("%s doesn't have legal coff magic number\n", a_name);
720 } 720 }
721 #endif 721 #endif
722 if (read (a_out, (char *) &ohdr, sizeof hdr) != sizeof hdr) 722 if (read (a_out, (char *) &ohdr, sizeof (hdr)) != sizeof (hdr))
723 { 723 {
724 PERROR (a_name); 724 PERROR (a_name);
725 } 725 }
726 726
727 if (N_BADMAG (ohdr)) 727 if (N_BADMAG (ohdr))
736 /* We probably could without too much trouble. The code is in gld 736 /* We probably could without too much trouble. The code is in gld
737 * but I don't have that much time or incentive. 737 * but I don't have that much time or incentive.
738 */ 738 */
739 ERROR0 ("can't build a COFF file from scratch yet"); 739 ERROR0 ("can't build a COFF file from scratch yet");
740 #else 740 #else
741 memset ((void *)&hdr, 0, sizeof hdr); 741 memset ((void *)&hdr, 0, sizeof (hdr));
742 #endif 742 #endif
743 } 743 }
744 744
745 unexec_text_start = (long) start_of_text (); 745 unexec_text_start = (long) start_of_text ();
746 unexec_data_start = data_start; 746 unexec_data_start = data_start;
786 coffheader.dsize = dp->s_size; 786 coffheader.dsize = dp->s_size;
787 coffheader.bsize = bp->s_size; 787 coffheader.bsize = bp->s_size;
788 coffheader.text_start = tp->s_vaddr; 788 coffheader.text_start = tp->s_vaddr;
789 coffheader.data_start = dp->s_vaddr; 789 coffheader.data_start = dp->s_vaddr;
790 } 790 }
791 if (write (new, &coffheader, sizeof coffheader) != sizeof coffheader) 791 if (write (new, &coffheader, sizeof (coffheader)) != sizeof (coffheader))
792 { 792 {
793 PERROR(new_name); 793 PERROR(new_name);
794 } 794 }
795 #endif /* COFF_ENCAPSULATE */ 795 #endif /* COFF_ENCAPSULATE */
796 796
797 if (write (new, (char *) &hdr, sizeof hdr) != sizeof hdr) 797 if (write (new, (char *) &hdr, sizeof (hdr)) != sizeof (hdr))
798 { 798 {
799 PERROR (new_name); 799 PERROR (new_name);
800 } 800 }
801 801
802 #if 0 /* This #ifndef caused a bug on Linux when using QMAGIC. */ 802 #if 0 /* This #ifndef caused a bug on Linux when using QMAGIC. */
1097 lseek (a_out, lnnoptr, 0); /* start copying from there */ 1097 lseek (a_out, lnnoptr, 0); /* start copying from there */
1098 else 1098 else
1099 #endif /* COFF */ 1099 #endif /* COFF */
1100 lseek (a_out, SYMS_START, 0); /* Position a.out to symtab. */ 1100 lseek (a_out, SYMS_START, 0); /* Position a.out to symtab. */
1101 1101
1102 while ((n = read (a_out, page, sizeof page)) > 0) 1102 while ((n = read (a_out, page, sizeof (page))) > 0)
1103 { 1103 {
1104 if (write (new, page, n) != n) 1104 if (write (new, page, n) != n)
1105 { 1105 {
1106 PERROR (new_name); 1106 PERROR (new_name);
1107 } 1107 }