Subject: New options for ld(1) (#240) Index: bin/ld/ld.c,man/man1/ld.1 2.11BSD Description: Two new options were added to ld(1). -q now suppresses the undefined symbol message and -v enables the VM statistics output (which were previously alway printed). Repeat-By: N/A Fix: When building networked kernels a large number of undefined symbols are expected due to the multiphase linking proceedure. These messages are distracting and have caused some folks to cancel or interrupt the proceedure. '-q' will be used in future kernel Makefiles to suppress the expected undefined symbol messages. By popular demand the VM statistics message(s) have been made optional. Now the "nswap ... sbrk ..." message will not normally be printed. Using -v will cause ld(1) to emit the statistics. The man page has been updated to reflect the new options. Cut where indicated, saving the patch to something like /tmp/foo. Then: patch < /tmp/foo cd /usr/src/bin/ld make make install make clean cd /usr/src/man/man1 /usr/man/manroff ld.1 > /usr/man/cat1/ld.0 ========================cut here=================== *** /usr/src/man/man1/ld.1.old Mon May 10 20:45:51 1993 --- /usr/src/man/man1/ld.1 Mon May 8 21:30:13 1995 *************** *** 2,10 **** .\" All rights reserved. The Berkeley software License Agreement .\" specifies the terms and conditions for redistribution. .\" ! .\" @(#)ld.1 6.3 (2.11BSD GTE) 5/10/93 .\" ! .TH LD 1 "February 23, 1987" .UC 2 .SH NAME ld \- link editor (2BSD) --- 2,10 ---- .\" All rights reserved. The Berkeley software License Agreement .\" specifies the terms and conditions for redistribution. .\" ! .\" @(#)ld.1 6.4 (2.11BSD GTE) 1995/05/08 .\" ! .TH LD 1 "May 08, 1995" .UC 2 .SH NAME ld \- link editor (2BSD) *************** *** 129,135 **** This option creates a `pure executable' format. .TP ! .B "\-i (PDP-11 only)" When the output file is executed, the program text and data areas will live in separate address spaces. The only difference between this option --- 129,135 ---- This option creates a `pure executable' format. .TP ! .B \-i When the output file is executed, the program text and data areas will live in separate address spaces. The only difference between this option *************** *** 154,160 **** option to 2.11BSD allows makefiles to be copied freely between multiple platforms once again. .TP ! .B "\-O (PDP-11 only)" This is a text replacement overlay file; only the text segment will be replaced by .IR execve (2). --- 154,160 ---- option to 2.11BSD allows makefiles to be copied freely between multiple platforms once again. .TP ! .B \-O This is a text replacement overlay file; only the text segment will be replaced by .IR execve (2). *************** *** 196,201 **** --- 196,207 ---- This information can also be removed by .IR strip (1). .TP + .B \-q + ("quiet") Suppress the reporting of undefined symbols. Normally only + used when building networked kernels \- the large number of undefined + symbols is normal (due to the three phase link proceedure) but can be + distracting none the less. + .TP .B \-t ("trace") Print the name of each file as it is processed. .TP *************** *** 205,210 **** --- 211,221 ---- for loading wholly from a library, since initially the symbol table is empty and an unresolved reference is needed to force the loading of the first routine. + .TP + .B \-v + ("verbose") Print the VM statistics. Printing out the number of + pages swapped to and from the VM tmp file is now optional and only + used when a problem is suspected (or if you are voyeuristic). .TP .B \-X Save local symbols *************** *** 226,232 **** especially when debugging overlaid programs, so some debugging information is necessarily lost if this option is used. .TP ! .B "\-Z (PDP-11 only)" Indicate the creation of an automatic-overlay format. In addition a .B \-i or --- 237,243 ---- especially when debugging overlaid programs, so some debugging information is necessarily lost if this option is used. .TP ! .B \-Z Indicate the creation of an automatic-overlay format. In addition a .B \-i or *************** *** 246,252 **** overlay. This interface ("thunk") arranges for the correct overlay to be present before the actual routine is entered. .TP ! .B "\-Y (PDP-11 only) Terminate text overlays. This allows any remaining modules or libraries to be loaded into the base area. Note that the .B \-Y --- 257,263 ---- overlay. This interface ("thunk") arranges for the correct overlay to be present before the actual routine is entered. .TP ! .B \-Y Terminate text overlays. This allows any remaining modules or libraries to be loaded into the base area. Note that the .B \-Y *************** *** 318,321 **** adb(1), ar(1), as(1), cc(1), checkobj(1), f77(1), file(1), ranlib(1), size(1), a.out(5) .SH BUGS ! The text overlay scheme presented is unique to the PDP-11 and 2BSD. --- 329,334 ---- adb(1), ar(1), as(1), cc(1), checkobj(1), f77(1), file(1), ranlib(1), size(1), a.out(5) .SH BUGS ! The text overlay scheme presented is unique to the PDP-11 and 2BSD. The ! \-i, \-P, \-Z, \-Y options are specific to 2BSD. The \-q and \-v options ! are new with 2.11BSD. *** /usr/src/bin/ld/ld.c.old Sat Jan 22 16:43:18 1994 --- /usr/src/bin/ld/ld.c Mon May 8 21:14:50 1995 *************** *** 1,8 **** #if defined(DOSCCS) && !defined(lint) ! static char *sccsid = "@(#)ld.c 4.2 1/2/94"; #endif /* * 4.3 1/14/94 - sms * Make the number of VM segments a compile time option in the Makefile. * 4.2 1/2/94 - sms --- 1,13 ---- #if defined(DOSCCS) && !defined(lint) ! static char *sccsid = "@(#)ld.c 4.4 1995/05/08"; #endif /* + * 4.4 1995/05/08 - sms + * Add -q to turn off undefined symbol reporting. Used when building + * networking kernels and many undefineds are expected but look worrisome. + * Add -v to enable the VM statistics printout (now optional). + * * 4.3 1/14/94 - sms * Make the number of VM segments a compile time option in the Makefile. * 4.2 1/2/94 - sms *************** *** 203,209 **** --- 208,216 ---- /* * Options. */ + int quiet; /* -q, suppress undefined error message */ int trace; + int verbose; /* -v, emit VM statistics */ int xflag; /* discard local symbols */ int Xflag; /* discard locals starting with 'L' */ int Sflag; /* discard all except locals and globals*/ *************** *** 416,421 **** --- 423,434 ---- case 't': trace++; continue; + case 'q': + quiet++; + continue; + case 'v': + verbose++; + continue; case 'L': goto next; case 'O': *************** *** 454,460 **** } curov++; continue; - case 'v': case 'y': case 'A': case 'H': --- 467,472 ---- *************** *** 477,484 **** unlink("l.out"); if (delarg==0) chmod(ofilename, 0777 & ~umask(0)); ! printf("ld: nswaps: %ld, nmapsegs: %ld sbrk(0): %u\n", nswaps, ! nmapsegs, sbrk(0)); exit(delarg); } --- 489,497 ---- unlink("l.out"); if (delarg==0) chmod(ofilename, 0777 & ~umask(0)); ! if (verbose) ! printf("ld: nswaps: %ld, nmapsegs: %ld sbrk(0): %u\n", nswaps, ! nmapsegs, sbrk(0)); exit(delarg); } *************** *** 1091,1096 **** --- 1104,1111 ---- errlev |= 01; if ((arflag==0 || dflag) && sp->n_value==0) { if (i == p_end || i == p_etext || i == p_edata) + continue; + if (quiet) continue; if (nund==0) printf("Undefined:\n"); *** /VERSION.old Sat May 6 21:59:31 1995 --- /VERSION Mon May 8 21:34:07 1995 *************** *** 1,4 **** ! Current Patch Level: 239 2.11 BSD ============ --- 1,4 ---- ! Current Patch Level: 240 2.11 BSD ============