changeset 14787:0c751a0e86cd

(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.
author Richard M. Stallman <rms@gnu.org>
date Fri, 08 Mar 1996 05:02:23 +0000
parents 9da6f220abd8
children a3b8405017f4
files src/unexaix.c
diffstat 1 files changed, 17 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/unexaix.c	Fri Mar 08 05:02:06 1996 +0000
+++ b/src/unexaix.c	Fri Mar 08 05:02:23 1996 +0000
@@ -597,6 +597,7 @@
   return 0;
 }
 
+#define UnexBlockSz (1<<12)			/* read/write block size */
 write_segment (new, ptr, end)
      int new;
      register char *ptr, *end;
@@ -604,14 +605,12 @@
   register int i, nwrite, ret;
   char buf[80];
   extern int errno;
-  char zeros[128];
-
-  bzero (zeros, sizeof zeros);
+  char zeros[UnexBlockSz];
 
   for (i = 0; ptr < end;)
     {
-      /* distance to next multiple of 128.  */
-      nwrite = (((int) ptr + 128) & -128) - (int) ptr;
+      /* distance to next block.  */
+      nwrite = (((int) ptr + UnexBlockSz) & -UnexBlockSz) - (int) ptr;
       /* But not beyond specified end.  */
       if (nwrite > end - ptr) nwrite = end - ptr;
       ret = write (new, ptr, nwrite);
@@ -621,7 +620,8 @@
 	 So write zeros for it.  */
       if (ret == -1 && errno == EFAULT)
 	{
-	write (new, zeros, nwrite);
+	  bzero (zeros, nwrite);
+	  write (new, zeros, nwrite);
 	}
       else if (nwrite != ret)
 	{
@@ -645,7 +645,7 @@
      int new, a_out;
      char *a_name, *new_name;
 {
-  char page[1024];
+  char page[UnexBlockSz];
   int n;
 
   if (a_out < 0)
@@ -752,6 +752,13 @@
   for (nsyms = 0; nsyms < f_hdr.f_nsyms; nsyms++)
     {
       read (new, &symentry, SYMESZ);
+      if (symentry.n_sclass == C_BINCL || symentry.n_sclass == C_EINCL)
+	{
+	  symentry.n_value += bias;
+	  lseek (new, -SYMESZ, 1);
+	  write (new, &symentry, SYMESZ);
+	}
+
       for (naux = symentry.n_numaux; naux-- != 0; )
 	{
 	  read (new, &auxentry, AUXESZ);
@@ -788,7 +795,6 @@
   ulong t_reloc = (ulong) &_text - f_ohdr.text_start;
   ulong d_reloc = (ulong) &_data - ALIGN(f_ohdr.data_start, 2);
   int * p;
-  int dirty;
 
   if (load_scnptr == 0)
     return 0;
@@ -820,20 +826,12 @@
 	  }
 	ldrel = ldrel_buf;
       }
-      dirty = 0;
-
-      /* this code may not be necessary */
-      /* I originally had == in the "assignment" and it still unrelocated */
 
       /* move the BSS loader symbols to the DATA segment */
-      if (ldrel->l_rsecnm == f_ohdr.o_snbss)
-	ldrel->l_rsecnm = f_ohdr.o_sndata, dirty++;
+      if (ldrel->l_symndx == SYMNDX_BSS)
+	{
+	  ldrel->l_symndx = SYMNDX_DATA;
 
-      if (ldrel->l_symndx == SYMNDX_BSS)
-	ldrel->l_symndx = SYMNDX_DATA, dirty++;
-
-      if (dirty)
-	{
 	  lseek (new,
 		 load_scnptr + LDHDRSZ + LDSYMSZ*ldhdr.l_nsyms + LDRELSZ*i,
 		 0);