[7313] in Athena Bugs

home help back first fref pref prev next nref lref last post

/bin/ld

daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Thu Mar 14 22:35:51 1991

To: bugs@ATHENA.MIT.EDU
Date: Thu, 14 Mar 91 22:35:37 EST
From: John Carr <jfc@ATHENA.MIT.EDU>


This patch allows ld to be compiled with read-only strings, fixes the bug
with undefined symbols and -Z, and prints a better message for a certain
error.  There are a couple checks for NULL pointers added.  I don't remember
why I added them or what (if anything) they fix.

*** /source/bsd-4.3/rt/bin/ld.c	Wed Jul 11 13:31:13 1990
--- ld.c	Thu Mar 14 22:27:02 1991
***************
*** 572,588 ****
  	libn[ndir].l_name = "/usr/370root/usr/local/lib/libxxxxxxxxxxxxxxx";
  	libn[ndir++].l_cpos = 30;
  #else
! 	libn[ndir].l_name = "/lib/libxxxxxxxxxxxxxxx";
  	libn[ndir++].l_cpos = 8;
  
! 	libn[ndir].l_name = "/usr/lib/libxxxxxxxxxxxxxxx";
  	libn[ndir++].l_cpos = 12;
  
! 	libn[ndir].l_name = "/usr/athena/lib/libxxxxxxxxxxxxxxx";
  	libn[ndir++].l_cpos = 19;
  
! 	libn[ndir].l_name = "/usr/local/lib/libxxxxxxxxxxxxxxx";
  	libn[ndir++].l_cpos = 18;
  #endif
  
  	sawocs = sawncs = 0;
--- 567,590 ----
  	libn[ndir].l_name = "/usr/370root/usr/local/lib/libxxxxxxxxxxxxxxx";
  	libn[ndir++].l_cpos = 30;
  #else
!        {
! 	 static char liblib[] = "/lib/libxxxxxxxxxxxxxxx";
! 	 static char usrliblib[] = "/usr/lib/libxxxxxxxxxxxxxxx";
! 	 static char usrathenaliblib[] = "/usr/athena/lib/libxxxxxxxxxxxxxxx";
! 	 static char usrlocalliblib[] = "/usr/local/lib/libxxxxxxxxxxxxxxx";
! 	 libn[ndir].l_name = liblib;
  	 libn[ndir++].l_cpos = 8;
  
! 	 
! 	libn[ndir].l_name = usrliblib;
  	libn[ndir++].l_cpos = 12;
  
! 	libn[ndir].l_name = usrathenaliblib;
  	libn[ndir++].l_cpos = 19;
  
! 	libn[ndir].l_name = usrlocalliblib;
  	libn[ndir++].l_cpos = 18;
+        }
  #endif
  
  	sawocs = sawncs = 0;
***************
*** 1069,1079 ****
                 if ((hp = slookup(tp->ran_un.ran_name)) == 0)
                         continue;
                 sp = *hp;
! #ifdef ibm370
! 		if (!sp) {
  			continue;
- 		}
- #endif ibm370
                 if (sp->n_type != N_EXT+N_UNDF)
                         continue;
                 step(tp->ran_off);
--- 1070,1077 ----
  		if ((hp = slookup(tp->ran_un.ran_name)) == 0)
  			continue;
  		sp = *hp;
! 		if (!sp)
  			continue;
  		if (sp->n_type != N_EXT+N_UNDF)
  			continue;
  		step(tp->ran_off);
***************
*** 1211,1216 ****
--- 1209,1216 ----
  				sawovsym[i] = 1;
  			   }
                 type = cursym.n_type;
+ 	       if(cursym.n_un.n_name == 0)
+ 			continue;
                 if ((type&N_EXT)==0) {
  			if (Xflag==0 || cursym.n_un.n_name[0]!='L' ||
  			    type & N_STAB)
***************
*** 1803,1809 ****
                                 }
                 if ((type&N_EXT) == 0) {
                         if (!sflag&&!xflag&&
!                            (!Xflag||cursym.n_un.n_name[0]!='L'||type&N_STAB))
                                 symwrite(&cursym, sout);
                         continue;
                 }
--- 1803,1811 ----
                                 }
                 if ((type&N_EXT) == 0) {
                         if (!sflag&&!xflag&&
!                            (!Xflag||
! 			    (cursym.n_un.n_name && cursym.n_un.n_name[0]!='L')||
! 			    type&N_STAB))
                                 symwrite(&cursym, sout);
                         continue;
                 }
***************
*** 1832,1838 ****
                 }
                 if (cursym.n_type & N_STAB)
                         continue;
!                if (cursym.n_type!=sp->n_type || cursym.n_value!=sp->n_value) {
                         fprintf(stderr, "%s: ", cursym.n_un.n_name);
                         error(0, "multiply defined");
                 }
--- 1834,1841 ----
  		}
  		if (cursym.n_type & N_STAB)
  			continue;
! 		if (cursym.n_type!=sp->n_type ||
! 		    cursym.n_value!=sp->n_value && sp->n_value != torigin) {
  			fprintf(stderr, "%s: ", cursym.n_un.n_name);
  			error(0, "multiply defined");
  		}
***************
*** 2032,2038 ****
  				tw = tw & 0xffffff;
  			   }
  			} else {  /* as or ld botch ??? */
! 			   error(0,"Op-code invalid for 20/24 bit data. as/ld botch?");
  			}
  		   }
  #endif ibm370
--- 2035,2049 ----
  				tw = tw & 0xffffff;
  			   }
  			} else {  /* as or ld botch ??? */
! 			  char err[128];
! 			  for(lp = lochash[rp->r_symbolnum % LHSIZ];
! 			      lp->l_index != rp->r_symbolnum;
! 			      lp = lp->l_link)
! 			    ;
! 			  sp = lp->l_symbol;
! 			  sprintf(err, "Op-code %x(%x) @ pc %x invalid for 20/24 bit data\n\tsymbol name is \"%s\")\n",
! 				  opcode, tw, creloc, sp->n_un.n_name);
! 			  error(0,err);
  			}
  		   }
  #endif ibm370

home help back first fref pref prev next nref lref last post