diff options
| author | Richard M. Stallman | 1996-03-08 05:02:23 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-03-08 05:02:23 +0000 |
| commit | 91b97ddb7ecd096ee3bd7f1b7d47f78400aff5fc (patch) | |
| tree | 20b8eaefcfc5ed13c95707e7db183640e7894e74 /src | |
| parent | f7a460e052596ccd84cf80f9e4ce8507cf05bbb7 (diff) | |
| download | emacs-91b97ddb7ecd096ee3bd7f1b7d47f78400aff5fc.tar.gz emacs-91b97ddb7ecd096ee3bd7f1b7d47f78400aff5fc.zip | |
(write_segment,copy_sym): Increase blocking from 128 to 4k bytes.
(adjust_lnnoptrs): Handle include file names, mostly for dbx.
(unrelocate_symbols): Remove some unnecessary tests.
Diffstat (limited to 'src')
| -rw-r--r-- | src/unexaix.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/src/unexaix.c b/src/unexaix.c index 445f01886dd..9fcdef808c8 100644 --- a/src/unexaix.c +++ b/src/unexaix.c | |||
| @@ -597,6 +597,7 @@ copy_text_and_data (new) | |||
| 597 | return 0; | 597 | return 0; |
| 598 | } | 598 | } |
| 599 | 599 | ||
| 600 | #define UnexBlockSz (1<<12) /* read/write block size */ | ||
| 600 | write_segment (new, ptr, end) | 601 | write_segment (new, ptr, end) |
| 601 | int new; | 602 | int new; |
| 602 | register char *ptr, *end; | 603 | register char *ptr, *end; |
| @@ -604,14 +605,12 @@ write_segment (new, ptr, end) | |||
| 604 | register int i, nwrite, ret; | 605 | register int i, nwrite, ret; |
| 605 | char buf[80]; | 606 | char buf[80]; |
| 606 | extern int errno; | 607 | extern int errno; |
| 607 | char zeros[128]; | 608 | char zeros[UnexBlockSz]; |
| 608 | |||
| 609 | bzero (zeros, sizeof zeros); | ||
| 610 | 609 | ||
| 611 | for (i = 0; ptr < end;) | 610 | for (i = 0; ptr < end;) |
| 612 | { | 611 | { |
| 613 | /* distance to next multiple of 128. */ | 612 | /* distance to next block. */ |
| 614 | nwrite = (((int) ptr + 128) & -128) - (int) ptr; | 613 | nwrite = (((int) ptr + UnexBlockSz) & -UnexBlockSz) - (int) ptr; |
| 615 | /* But not beyond specified end. */ | 614 | /* But not beyond specified end. */ |
| 616 | if (nwrite > end - ptr) nwrite = end - ptr; | 615 | if (nwrite > end - ptr) nwrite = end - ptr; |
| 617 | ret = write (new, ptr, nwrite); | 616 | ret = write (new, ptr, nwrite); |
| @@ -621,7 +620,8 @@ write_segment (new, ptr, end) | |||
| 621 | So write zeros for it. */ | 620 | So write zeros for it. */ |
| 622 | if (ret == -1 && errno == EFAULT) | 621 | if (ret == -1 && errno == EFAULT) |
| 623 | { | 622 | { |
| 624 | write (new, zeros, nwrite); | 623 | bzero (zeros, nwrite); |
| 624 | write (new, zeros, nwrite); | ||
| 625 | } | 625 | } |
| 626 | else if (nwrite != ret) | 626 | else if (nwrite != ret) |
| 627 | { | 627 | { |
| @@ -645,7 +645,7 @@ copy_sym (new, a_out, a_name, new_name) | |||
| 645 | int new, a_out; | 645 | int new, a_out; |
| 646 | char *a_name, *new_name; | 646 | char *a_name, *new_name; |
| 647 | { | 647 | { |
| 648 | char page[1024]; | 648 | char page[UnexBlockSz]; |
| 649 | int n; | 649 | int n; |
| 650 | 650 | ||
| 651 | if (a_out < 0) | 651 | if (a_out < 0) |
| @@ -752,6 +752,13 @@ adjust_lnnoptrs (writedesc, readdesc, new_name) | |||
| 752 | for (nsyms = 0; nsyms < f_hdr.f_nsyms; nsyms++) | 752 | for (nsyms = 0; nsyms < f_hdr.f_nsyms; nsyms++) |
| 753 | { | 753 | { |
| 754 | read (new, &symentry, SYMESZ); | 754 | read (new, &symentry, SYMESZ); |
| 755 | if (symentry.n_sclass == C_BINCL || symentry.n_sclass == C_EINCL) | ||
| 756 | { | ||
| 757 | symentry.n_value += bias; | ||
| 758 | lseek (new, -SYMESZ, 1); | ||
| 759 | write (new, &symentry, SYMESZ); | ||
| 760 | } | ||
| 761 | |||
| 755 | for (naux = symentry.n_numaux; naux-- != 0; ) | 762 | for (naux = symentry.n_numaux; naux-- != 0; ) |
| 756 | { | 763 | { |
| 757 | read (new, &auxentry, AUXESZ); | 764 | read (new, &auxentry, AUXESZ); |
| @@ -788,7 +795,6 @@ unrelocate_symbols (new, a_out, a_name, new_name) | |||
| 788 | ulong t_reloc = (ulong) &_text - f_ohdr.text_start; | 795 | ulong t_reloc = (ulong) &_text - f_ohdr.text_start; |
| 789 | ulong d_reloc = (ulong) &_data - ALIGN(f_ohdr.data_start, 2); | 796 | ulong d_reloc = (ulong) &_data - ALIGN(f_ohdr.data_start, 2); |
| 790 | int * p; | 797 | int * p; |
| 791 | int dirty; | ||
| 792 | 798 | ||
| 793 | if (load_scnptr == 0) | 799 | if (load_scnptr == 0) |
| 794 | return 0; | 800 | return 0; |
| @@ -820,20 +826,12 @@ unrelocate_symbols (new, a_out, a_name, new_name) | |||
| 820 | } | 826 | } |
| 821 | ldrel = ldrel_buf; | 827 | ldrel = ldrel_buf; |
| 822 | } | 828 | } |
| 823 | dirty = 0; | ||
| 824 | |||
| 825 | /* this code may not be necessary */ | ||
| 826 | /* I originally had == in the "assignment" and it still unrelocated */ | ||
| 827 | 829 | ||
| 828 | /* move the BSS loader symbols to the DATA segment */ | 830 | /* move the BSS loader symbols to the DATA segment */ |
| 829 | if (ldrel->l_rsecnm == f_ohdr.o_snbss) | ||
| 830 | ldrel->l_rsecnm = f_ohdr.o_sndata, dirty++; | ||
| 831 | |||
| 832 | if (ldrel->l_symndx == SYMNDX_BSS) | 831 | if (ldrel->l_symndx == SYMNDX_BSS) |
| 833 | ldrel->l_symndx = SYMNDX_DATA, dirty++; | ||
| 834 | |||
| 835 | if (dirty) | ||
| 836 | { | 832 | { |
| 833 | ldrel->l_symndx = SYMNDX_DATA; | ||
| 834 | |||
| 837 | lseek (new, | 835 | lseek (new, |
| 838 | load_scnptr + LDHDRSZ + LDSYMSZ*ldhdr.l_nsyms + LDRELSZ*i, | 836 | load_scnptr + LDHDRSZ + LDSYMSZ*ldhdr.l_nsyms + LDRELSZ*i, |
| 839 | 0); | 837 | 0); |