Subject: Object file symbols limited to 8 characters [+FIX] (#169 - #12 of 19)
Index:	cc,as,ld,ar,ranlib,nm,nlist,adb,... (2.11BSD)

Description:
	For some time now (seem like eons;-)) the object file format used 
	by Unix for the PDP-11 has restricted symbols to 8 significant 
	characters (actually 7 due to the C compiler prefixing symbols with 
	a leading tilde (~) or underscore (_)).

	Aside from the "creative constraints" this imposes on the programmer
	there was the continuing problem of 'name collisions', especially
	when porting applications from machines whose object file format
	permitted longer symbol names.

	Numerous workarounds have been employed in the past.  The
	most common one relied on a combination of a name collision
	detection program ('shortc') and the flexname capability of the
	C preprocessor ('cpp').  This served to mask the problem while
	making debugging difficult due to mangled/synthetic symbol names.

Repeat-By:
	Attempt to compile the following program:

		int	this_is_a_long_name;
		int	this_is_a_long_name_too;

		main() { exit(0)};

Fix:
	This section is repeated in each of the 19 parts which make up
	the update kit.  You should read it perhaps once or twice, but
	then skip over it (how to do that is mentioned below).

	Taking a "hint" from the a.out(5) man page:

"The compiler will note name collisions when they occur within a single file...
There is really little that can be done about this.  Some thought is being
given to modifying the loader to flag detectable collisions, but the real
solution would be to change over to the 4BSD a.out format.  This would 
involve modifying the compiler, assembler and adb and then simply porting 
the 4.3BSD ld, nm, ranlib, strip and nlist.  Or perhaps simply porting the 
entire 4.3BSD suite might be best ...  Anyone interested in a project?"

	This I have done.  No more volunteers for the project need apply ;-)

	The new limit on symbol length is 32 characters!  There is still
	a limit (but it is _much_ more reasonable now) simply because of
	address space constraints - it needs to be possible to hold 
	at least one of the 'symbol' or 'string' tables in memory in many
	cases (nice to hold both, but - i know, get a 486;-)).

	It must be noted though that it is almost trivial now to raise
	the limit if that is desired - the programs which need to know
	the maximum length of a symbol string all have an easily changed
	#define statement now (usually MAXSYMLEN but there are a couple
	exceptions).  The 'string table' format itself doesn't care how 
	long the strings are.  The actual a.out format won't have to 
	change again to accomodate a higher limit on symbol name length!

	The "string table" object file format has been ported and all
	the necessary changes made throughout the entire system.

	The changes were *massive* and widespread.  Programs affected
	of course included the assembler and compiler.  Other programs
	affected were anything which accessed a symbol table entry either
	via nlist(3) [ps, pstat, fstat, vmstat, etc] or by reading
	object files [ld, ranlib, nm, adb, strip, etc].

	The actual changes to the compiler and assembler were minor
	because those programs had already been modified earlier 
	(updates #142, 143, 152, 153).  The compiler only needed to have
	the maximum size of a symbol name raised.  The assembler
	already knew how to generate 'string table' object files - all
	that needed to be done in 'as' was to flip a bit telling it
	to generate the new object format instead of the old style.

	+++++++++++++++
	And now for a bit of a narrative about what was done.   The
	detailed instructions for applying this part (#12 of 19) of the
	update kit follow the 'story' below.  This started out as
	a semi-organized accounting of what was done but then devolved
	into a semi-rambling tale due to the sheer bulk of the changes.

	You can skip to the details for applying #169 by searching for
	the string "=======" below - this header is replicated in all
	parts of this kit.
	+++++++++++++++

	Alas, the remaining changes were not so simple.  Complete
	replacements for ranlib(1), ar(1), nlist(3) were ported from
	the Net-2 release.  Other programs such as symorder(1) and
	two new programs 'symcompact' and 'strcompact' (used to
	compress/compact symbol and string tables) were written from
	scratch.

	Perhaps the two hardest parts of the whole effort were
	rewriting the linker 'ld' and making *large* modifications
	to the debugger 'adb'.  This was a very difficult job.
	'ld needed to scan new style ranlib archives, as well as
	using the "virtual memory" facility (the 'libvmf' routines 
	posted earlier) for symbol table management and so on.  'adb'
	was a MESS (having been written in a pseudo block structured
	macro language).  Since the new symbol table entry could be
	so much larger than the old it was no longer possible for adb
	to hold as much of the symbol table in memory - an alternate 
	method took a while to develope and implement, more on that
	in the patch which deals with adb (actually the changes to
	adb are so large there are two substantial parts of this update
	kit just for adb!).

	After the basic programs (ar, ld, ranlib, etc) were running
	the system had to be completely recompiled from sources, beginning
	with the object libraries.  After those were done the process
	of recompiling the rest of the system could proceed.

	Guess what happens when you recreate libc.a with a buggy linker?
	Yep - the system is rendered useless until backup copies of
	everything can be reloaded.  Don't let this happen to you - be
	sure (and i'll repeat the point later) to back up the system
	(or at least key executables and .a files) before installing
	this upgrade.

	In all there were about 330 files modified during the change of
	object file format.  Some of these were not directly related
	to the new object file format.  There were a number of (obsolete)
	references to "BSD2_10" lingering in the system.  Those 
	have been replaced with "pdp11" and the 'BSD2_10' define has
	been removed from the C preprocessor (cpp).  DO NOT use 'BSD2_10'
	to #ifdef pdp-11 sensitive code, use "pdp11" instead.

	During the recompile of the libraries a fairly large number of
	"shortened" names were lengthened - these included syscall routines
	such as "gethostname" which no longer had to be munged into
	"gethname".  Also a surprising number of typographical errors
	were uncovered (mainly in the Fortran libraries) where an extra
	character (beyond the 7th character) was left off or accidentally
	added.  These were all fixed and eventually, after a couple
	evenings, the libraries were built and installed.

	After the libraries were done it was the application programs'
	turn to be recompiled.  This took the better part of a couple 
	weeks to finally make it thru due to (as it turned out) the iterative 
	nature of the task.  A symbol would come up undefined and have
	to be tracked down exactly where the wrong definition/use was
	coming from.  Finally, however, the task was done and it was
	time to move on to the kernel.

	The kernel proved to be suprisingly easy - no real complications
	arose except when it came time to reboot, a bug had been introduced
	into 'autoconfig' (who uses 'nlist' to scan the kernel symbol table).
	Ouch!  That was another couple late nights.  Since the compiler
	supports unsigned longs now a number of small changes which
	ifdef'd 'u_long' to 'long' were removed.

	REMEMBER - you need to recompile 'autoconfig' and install it
	before rebooting the new kernel ;-)

	The performance of 'ps' though (and anything else which used
	nlist(3), 'fstat', 'w' are good examples) was unacceptably slow.

	So, amidst other delays (real work, the earthquake - which almost
	tossed the disc drive to the floor, etc) the "symorder" program
	was written (with ideas borrowed from the Net-2 version).  The
	symorder(1) program rather insists on holding both the symbol
	and string tables in memory - this was a problem (or could be
	if the kernel symbol table grows much more) so two new and 
	original programs were written:  'symcompact' and 'strcompact'.

	The first program compacts the symbol table by removing 
	'register' local variables (they're of no use to anyone - the debugger
	doesn't/can't do anything with them) and redundant global text
	symbols (symbols in an overlaid program which are in the root
	segment do not need both the '~' and '_' symbols present).

	The second program 'strcompact' is one that any 'string table'
	based object file system can use.  It implements "shared strings"
	for symbols - if a program has many references to 'error' as a
	local symbol, why store the string 'error' more than once?  Simply
	store one instance and then update the symbol table entries to
	all point to the same string!

	Using both 'strcompact' and 'symcompact' on the /unix image
	resulted in a file that was 15kb smaller.  Running 'symorder'
	then puts the most frequently used symbols at the front of the
	symbol table, the performance of 'w', 'pstat', and other programs
	which nlist(3) the kernel was now acceptable.

	Some of the parts of this kit are large.  The large patch files have
	been split into pieces which the 'patch' will handle, other parts
	(the replacement 'ar' sources) were left as a single 'shar' file
	rather than split them up.

	Each part of this kit consists of:

		a 'patchfile' - this is used with the "patch" program to
		update files.

		an optional 'script' - this is run ("sh script") to perform
		initialization, remove files, create directories and so on.

		an optional 'new.sources' - this is a "shar" file containing
		complete sources for a program.

	ALL pathnames are _absolute_ - this way you do not have to "cd"
	around the system, you should be able to apply all the patches
	while you are in /tmp (or /usr/tmp - wherever you have the most
	free space).

	Be sure that you have at least 40mb free on /usr before 
	rebuilding the system - if you do not then building in stages
	will be necessary.

	Part 19 contains the detailed instructions for rebuilding the
	system _after_ the previous 18 patches have been applied.

	The patches (#158 thru #175) should be applied in order following
	the directions in each part.

	DO NOT recompile anything once the patching has begun until requested
	to do so in part 19.  Many of the system include files are modified
	and the object file format is being changed - recompilation will not
	be possible until the transformation of the system and object libraries
	is complete.

	AT A MINIMUM you will want to back up the following files (unless
	you have a known good backup already made) in case you need to
	recompile something before part 19 is done:

		/bin/ar
		/bin/ld
		/bin/nm
		/bin/as
		/usr/bin/ranlib
		/lib/c0
		/lib/crt0.o
		/lib/mcrt0.o
		/lib/libc.a
		/bin/nm
		/usr/include/*.h
		/usr/include/sys/*.h

	In part 19 there is a *complete* list of all files affected
	(all 336 of them) - you may wish to back those up also.

	And now the common header ('boilerplate') is over (at last ;-)),
	let the installation guide begin.

	As always, the complete 2.11BSD updates are available via 
	anonymous FTP to 'ftp.iipo.gtegsc.com' in the directory /pub/2.11BSD

==========  #169 (Part #12 of 19)

	'make' has had the ability to search an archive for an entry
	point removed, this was less than useful to begin with and
	maintaining this (mis)feature would have cause 'make' to grow
	quite a bit in size.  The ability to search for an object file
	within an archive has been retained (and fixed).

	Three new man pages are included in the new.sources file: symorder,
	strcompact and symcompact.  These describe the new symbol table
	maintanence programs which perform symbol table ordering and
	compaction.

	This part updates the following files.  BACK THESE UP if you
	have any worries about the proceedure or do not have a bootable
	backup already at hand.

/usr/src/man/man1/make.1
/usr/src/man/man1/symorder.1
/usr/src/man/man1/Makefile
/usr/src/man/man1/strcompact.1
/usr/src/man/man1/symcompact.1
/usr/src/man/man5/a.out.5

	0) Be in a temp directory ("cd /tmp" or "cd /usr/tmp")

	1) Save the following shar archive to a file (/tmp/169 for example)

	2) Unpack the archive:  sh 169

	3) Patch the files:  patch -p0 < patchfile

	4) Unpack the new source replacements:  sh new.sources

	5) rm 169 patchfile new.sources

	Part 12 of 19 is done.  DO NOT rebuild or compile _anything_
	at this point!

===== cut here
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	patchfile
#	new.sources
# This archive created: Fri Feb  4 23:02:53 1994
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f 'patchfile'
then
	echo shar: "will not over-write existing file 'patchfile'"
else
sed 's/^X//' << \SHAR_EOF > 'patchfile'
X*** /usr/src/man/man1/make.1.old	Sat Aug 15 12:04:55 1987
X--- /usr/src/man/man1/make.1	Mon Jan  3 23:47:14 1994
X***************
X*** 57,75 ****
X  of the double colon, and is not affected by other double colon lines
X  on which that name may appear.
X  .PP
X! Two special forms of a name are recognized.
X! A name like
X  .IR a ( b )
X  means the file named
X  .I b
X  stored in the archive named
X  .I a.
X- A name like
X- .IR a (( b ))
X- means the file stored in archive
X- .I a
X- containing the entry point
X- .I b.
X  .PP
X  Sharp and newline surround comments.
X  .PP
X--- 57,68 ----
X  of the double colon, and is not affected by other double colon lines
X  on which that name may appear.
X  .PP
X! The special form of the name:
X  .IR a ( b )
X  means the file named
X  .I b
X  stored in the archive named
X  .I a.
X  .PP
X  Sharp and newline surround comments.
X  .PP
X*** /usr/src/man/man1/Makefile.old	Tue Jan 19 15:59:10 1993
X--- /usr/src/man/man1/Makefile	Wed Jan 26 21:15:39 1994
X***************
X*** 34,41 ****
X  	pxref.1 quota.1 ranlib.1 ratfor.1 rcp.1 rdist.1 refer.1 rev.1 \
X  	rlogin.1 rm.1 rmail.1 rmdir.1 roffbib.1 rsh.1 ruptime.1 rwho.1 \
X  	sccs.1 script.1 sed.1 sendbug.1 sh.1 size.1 sleep.1 soelim.1 \
X! 	sort.1 sortbib.1 spell.1 spline.1 split.1 strings.1 strip.1 \
X! 	struct.1 stty.1 style.1 su.1 sum.1 sysline.1 tabs.1 tail.1 talk.1 \
X  	tar.1 tbl.1 tc.1 tcopy.1 tee.1 telnet.1 test.1 time.1 \
X  	tip.1 tk.1 tn3270.1 touch.1 tp.1 tr.1 troff.1 true.1 tset.1 \
X  	tsort.1 tty.1 ul.1 unifdef.1 uniq.1 units.1 uptime.1 users.1 \
X--- 34,42 ----
X  	pxref.1 quota.1 ranlib.1 ratfor.1 rcp.1 rdist.1 refer.1 rev.1 \
X  	rlogin.1 rm.1 rmail.1 rmdir.1 roffbib.1 rsh.1 ruptime.1 rwho.1 \
X  	sccs.1 script.1 sed.1 sendbug.1 sh.1 size.1 sleep.1 soelim.1 \
X! 	sort.1 sortbib.1 spell.1 spline.1 split.1 strcompact.1 strings.1 \
X! 	strip.1 struct.1 stty.1 style.1 su.1 sum.1 symcompact.1 symorder.1 \
X! 	sysline.1 tabs.1 tail.1 talk.1 \
X  	tar.1 tbl.1 tc.1 tcopy.1 tee.1 telnet.1 test.1 time.1 \
X  	tip.1 tk.1 tn3270.1 touch.1 tp.1 tr.1 troff.1 true.1 tset.1 \
X  	tsort.1 tty.1 ul.1 unifdef.1 uniq.1 units.1 uptime.1 users.1 \
X***************
X*** 61,68 ****
X  	pxref.0 quota.0 ranlib.0 ratfor.0 rcp.0 rdist.0 refer.0 rev.0 \
X  	rlogin.0 rm.0 rmail.0 rmdir.0 roffbib.0 rsh.0 ruptime.0 rwho.0 \
X  	sccs.0 script.0 sed.0 sendbug.0 sh.0 size.0 sleep.0 soelim.0 \
X! 	sort.0 sortbib.0 spell.0 spline.0 split.0 strings.0 strip.0 \
X! 	struct.0 stty.0 style.0 su.0 sum.0 sysline.0 tabs.0 tail.0 talk.0 \
X  	tar.0 tbl.0 tc.0 tcopy.0 tee.0 telnet.0 test.0 time.0 \
X  	tip.0 tk.0 tn3270.0 touch.0 tp.0 tr.0 troff.0 true.0 tset.0 \
X  	tsort.0 tty.0 ul.0 unifdef.0 uniq.0 units.0 uptime.0 users.0 \
X--- 62,70 ----
X  	pxref.0 quota.0 ranlib.0 ratfor.0 rcp.0 rdist.0 refer.0 rev.0 \
X  	rlogin.0 rm.0 rmail.0 rmdir.0 roffbib.0 rsh.0 ruptime.0 rwho.0 \
X  	sccs.0 script.0 sed.0 sendbug.0 sh.0 size.0 sleep.0 soelim.0 \
X! 	sort.0 sortbib.0 spell.0 spline.0 split.0 strcompact.0 strings.0 \
X! 	strip.0 struct.0 stty.0 style.0 su.0 sum.0 symcompact.0 symorder.0 \
X! 	sysline.0 tabs.0 tail.0 talk.0 \
X  	tar.0 tbl.0 tc.0 tcopy.0 tee.0 telnet.0 test.0 time.0 \
X  	tip.0 tk.0 tn3270.0 touch.0 tp.0 tr.0 troff.0 true.0 tset.0 \
X  	tsort.0 tty.0 ul.0 unifdef.0 uniq.0 units.0 uptime.0 users.0 \
X*** /usr/src/man/man5/a.out.5.old	Wed Feb  4 19:00:20 1987
X--- /usr/src/man/man5/a.out.5	Sun Jan  9 17:47:42 1994
X***************
X*** 2,10 ****
X  .\" All rights reserved.  The Berkeley software License Agreement
X  .\" specifies the terms and conditions for redistribution.
X  .\"
X! .\"	@(#)a.out.5	2.3 (Berkeley) 1/26/87
X  .\"
X! .TH A.OUT 5 "January 26, 1987"
X  .UC 2
X  .SH NAME
X  a.out \- assembler and link editor output
X--- 2,10 ----
X  .\" All rights reserved.  The Berkeley software License Agreement
X  .\" specifies the terms and conditions for redistribution.
X  .\"
X! .\"	@(#)a.out.5	2.4 (2.11BSD GTE) 1/9/94
X  .\"
X! .TH A.OUT 5 "January 9, 1994"
X  .UC 2
X  .SH NAME
X  a.out \- assembler and link editor output
X***************
X*** 44,49 ****
X--- 44,54 ----
X  	unsigned int	ov_siz[NOVL];	/* size of i'th overlay */
X  };
X  
X+ struct	xexec {
X+ 	struct exec e;
X+ 	struct ovlhdr o;
X+ };
X+ 
X  #define	A_MAGIC1	0407	/* normal */
X  #define	A_MAGIC2	0410	/* read-only text */
X  #define	A_MAGIC3	0411	/* separated I&D */
X***************
X*** 63,74 ****
X  #define	N_TXTOFF(x) \e
X  	((x).a_magic==A_MAGIC5 || (x).a_magic==A_MAGIC6 ? \e
X  	sizeof(struct ovlhdr) + sizeof(struct exec) : sizeof(struct exec))
X  .fi
X  .PP
X! The file has four sections:
X  a header, the program text and data,
X! relocation information, and a symbol table (in that order).
X! The last two may be omitted
X  if the program was loaded
X  with the `\-s' option
X  of
X--- 68,96 ----
X  #define	N_TXTOFF(x) \e
X  	((x).a_magic==A_MAGIC5 || (x).a_magic==A_MAGIC6 ? \e
X  	sizeof(struct ovlhdr) + sizeof(struct exec) : sizeof(struct exec))
X+ 
X+ /*
X+  * The following were added as part of the new object file format.  They
X+  * call functions because calculating the sums of overlay sizes was too
X+  * messy (and verbose) to do 'inline'.
X+  *
X+  * NOTE: if the magic number is that of an overlaid object the program
X+  * must pass an extended header ('xexec') as the argument.
X+ */
X+ 
X+ off_t	n_stroff(), n_symoff(), n_datoff(), n_dreloc(), n_treloc();
X+ 
X+ #define	N_STROFF(e) (n_stroff(&e))
X+ #define	N_SYMOFF(e) (n_symoff(&e))
X+ #define	N_DATOFF(e) (n_datoff(&e))
X+ #define	N_DRELOC(e) (n_dreloc(&e))
X+ #define	N_TRELOC(e) (n_treloc(&e))
X  .fi
X  .PP
X! The file has five sections:
X  a header, the program text and data,
X! relocation information, a symbol table and a strings table (in that order).
X! The last three may be omitted
X  if the program was loaded
X  with the `\-s' option
X  of
X***************
X*** 151,156 ****
X--- 173,183 ----
X  The data segment is only extended as requested by
X  .IR brk (2).
X  .PP
X+ The include file \fBa.out.h\fP defines \fI_AOUT_INCLUDE_\fP, the include
X+ file \fBnlist.h\fP does not.  This permits compile time initialization
X+ of the \fIn_name\fP field for programs that are not looking at the executable
X+ header.
X+ .sp
X  The layout of a symbol table entry and the principal flag values
X  that distinguish symbol types are given in the include file as follows:
X  .PP
X***************
X*** 158,166 ****
X  .ta \w'#define  'u +\w'unsigned int  'u +\w'n_name[8]  'u
X  .PP
X  struct	nlist {
X! 	char	n_name[8];	/* symbol name */
X! 	int	n_type;		/* type flag */
X! 	unsigned int	n_value;	/* value */
X  };
X  
X  /*
X--- 185,201 ----
X  .ta \w'#define  'u +\w'unsigned int  'u +\w'n_name[8]  'u
X  .PP
X  struct	nlist {
X! #ifdef	_AOUT_INCLUDE_
X! 	union {
X! 		char *n_name;	/* In memory address of symbol name */
X! 		off_t n_strx;	/* String table offset (file) */
X! 	} n_un;
X! #else
X! 	char	*n_name;	/* symbol name (in memory) */
X! #endif
X! 	u_char	n_type;		/* Type of symbol - see below */
X! 	char	n_ovly;		/* Overlay number */
X! 	u_int	n_value;	/* Symbol value */
X  };
X  
X  /*
X***************
X*** 183,191 ****
X  #define	N_FORMAT	"%06o"
X  .fi
X  .PP
X- Other flag values may occur if an assembly language program
X- defines machine instructions.
X- .PP
X  If a symbol's type is undefined external,
X  and the value field is non-zero,
X  the symbol is interpreted by the loader
X--- 218,223 ----
X***************
X*** 255,301 ****
X  The remainder of the relocation word (bits 15-4)
X  contains a symbol number in the case of external
X  references, and is unused otherwise.
X  The first symbol is numbered 0, the second 1, etc.
X  .SH "SEE ALSO"
X  as(1), ld(1), nm(1), strip(1), nlist(3)
X  .SH BUGS
X! The fixed maximum of eight characters for symbol names in
X  .I a.out
X! files leads to naming collisions between symbols which aren't unique
X! within the first eight characters.  The problem is compounded by the C
X! compiler which prefaces all external symbol names with a `_' causing
X! external names not unique within the first seven characters to
X! collide.  The compiler will note name collisions when they occur within
X! a single file.  The loader
X! .I ld
X! will not flag name collisions of any kind between separate objects even when
X! an error is obvious.
X  .PP
X! There is really little that can be done about this.  Some thought is being
X! given to modifying the loader to flag detectable collisions, but the real
X! solution would be to change over to the
X  .I 4BSD a.out
X! format.  This would involve modifying the compiler
X! .RI ( /lib/c[012] ),
X! assembler
X! .RI ( /bin/as " and " /lib/as2 )
X! and
X! .IR adb (1)
X! and then simply porting the 4.3BSD
X! .IR ld (1),
X  .IR nm (1),
X  .IR ranlib (1),
X  .IR strip "(1) and"
X  .IR nlist (3).
X- Or perhaps simply porting the entire 4.3BSD suite might be best ...  Anyone
X- interested in a project?
X  .PP
X! In the meantime, letting the compiler catch any collisions it can and then
X! scanning the loaded object file for symbol names eight characters long and
X! then using that list to rescan the source seems to be the best method for
X! finding collisions.  Once a list of collisions is build, the C preprocessor
X! .I cpp
X! can be used to translate the offending names into shorter unique names since
X! .I cpp
X! uses
X! .IR FLEXNAMES .
X--- 287,324 ----
X  The remainder of the relocation word (bits 15-4)
X  contains a symbol number in the case of external
X  references, and is unused otherwise.
X+ .PP
X+ The string table begins with a longword containing the length of the string
X+ table (including the longword itself).  All strings are null terminated.
X+ .PP
X  The first symbol is numbered 0, the second 1, etc.
X  .SH "SEE ALSO"
X  as(1), ld(1), nm(1), strip(1), nlist(3)
X  .SH BUGS
X! The current implementation places a maximum length of 32 characters for 
X! symbol names in
X  .I a.out
X! files.  This is (relatively) easily raised with the caveat that the linker
X! and other programs which look at symbol tables will slow down even more
X! than they already have.  
X  .PP
X! The
X  .I 4BSD a.out
X! format has been implemented. This involved modifying the first phase of
X! the C compiler
X! .RI ( /lib/c0 ),
X! the assembler
X! .RI ( /bin/as ),
X! the debugger
X! .RI adb (1), 
X! the linker
X! .RI ld (1),
X! and then simply porting the 4.3BSD/Net\-2
X! .IR ar (1),
X  .IR nm (1),
X  .IR ranlib (1),
X  .IR strip "(1) and"
X  .IR nlist (3).
X  .PP
X! As part of this effort the include file \fIshort_names.h\fP has gone away.
X! 
SHAR_EOF
fi
if test -f 'new.sources'
then
	echo shar: "will not over-write existing file 'new.sources'"
else
sed 's/^X//' << \SHAR_EOF > 'new.sources'
X#! /bin/sh
X# This is a shell archive, meaning:
X# 1. Remove everything above the #! /bin/sh line.
X# 2. Save the resulting text in a file.
X# 3. Execute the file with /bin/sh (not csh) to create:
X#	/usr/src/man/man1/symorder.1
X#	/usr/src/man/man1/strcompact.1
X#	/usr/src/man/man1/symcompact.1
X# This archive created: Fri Jan 28 21:23:44 1994
Xexport PATH; PATH=/bin:/usr/bin:$PATH
Xif test -f '/usr/src/man/man1/symorder.1'
Xthen
X	echo shar: "will not over-write existing file '/usr/src/man/man1/symorder.1'"
Xelse
Xsed 's/^X//' << \SHAR_EOF > '/usr/src/man/man1/symorder.1'
XX.\" Copyright (c) 1980, 1990 The Regents of the University of California.
XX.\" All rights reserved.
XX.\"
XX.\" Redistribution and use in source and binary forms, with or without
XX.\" modification, are permitted provided that the following conditions
XX.\" are met:
XX.\" 1. Redistributions of source code must retain the above copyright
XX.\"    notice, this list of conditions and the following disclaimer.
XX.\" 2. Redistributions in binary form must reproduce the above copyright
XX.\"    notice, this list of conditions and the following disclaimer in the
XX.\"    documentation and/or other materials provided with the distribution.
XX.\" 3. All advertising materials mentioning features or use of this software
XX.\"    must display the following acknowledgement:
XX.\"	This product includes software developed by the University of
XX.\"	California, Berkeley and its contributors.
XX.\" 4. Neither the name of the University nor the names of its contributors
XX.\"    may be used to endorse or promote products derived from this software
XX.\"    without specific prior written permission.
XX.\"
XX.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
XX.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
XX.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
XX.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
XX.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
XX.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
XX.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
XX.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
XX.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
XX.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
XX.\" SUCH DAMAGE.
XX.\"
XX.\"     @(#)symorder.1	6.5.1 (2.11BSD GTE) 1/22/94
XX.\"
XX.TH SYMORDER 1 "January 22, 1994"
XX.UC 4
XX.SH NAME
XXsymorder \- rearrange name list
XX.SH SYNOPSIS
XX.B symorder
XXsymlist file
XX.SH DESCRIPTION
XXThe file
XX.IR symlist
XXcontains a list of symbols to be found in
XX.IR file,
XXone symbol per line.
XX.PP
XXThe symbol table of
XX.IR file
XXis updated in place;
XXsymbols read from
XX.IR symlist
XXare relocated to the beginning of the table and in the order given.
XX.PP
XXThis program was specifically designed to cut down on the
XXoverhead of getting symbols from the kernel name list.
XX.SH DIAGNOSTICS
XXThe
XX.IR symorder (1)
XXutility exits 0 on success, non zero if an error occurs.
XX.SH SEE ALSO
XXnm(1), nlist(3), strip(1)
XX.SH HISTORY
XXThe
XX.B symorder
XXcommand appeared in 3.0BSD.
XSHAR_EOF
Xchmod 444 '/usr/src/man/man1/symorder.1'
Xfi
Xif test -f '/usr/src/man/man1/strcompact.1'
Xthen
X	echo shar: "will not over-write existing file '/usr/src/man/man1/strcompact.1'"
Xelse
Xsed 's/^X//' << \SHAR_EOF > '/usr/src/man/man1/strcompact.1'
XX.\" Public domain 1994 - Steven Schultz
XX.\"
XX.\"	@(#)strcompact.1	1.0 (2.11BSD GTE) 1/25/94
XX.\"
XX.TH strcompact 1 "January 25, 1994"
XX.UC 2
XX.SH NAME
XXstrcompact \- string compaction for object files
XX.SH SYNOPSIS
XXstrcompact [ \fBobject_name\fP ... ]
XX.SH DESCRIPTION
XXstrcompact
XXscans the symbol and string tables of an object file looking for multiple
XXreferences in the symbol table to the same string.  The string offset of
XXsymbol table entries is updated to preserve only one copy of the string.
XX.PP
XX.B
XXstrcompact
XXcut the size of the kernel string table by about 25%.
XX.PP
XXThe user must have write permission to the object/executable file.
XX.PP
XX.B strcompact
XXwrites to \fIstderr\fP the number of shared strings found.
XX.PP
XXstrcompact
XXexits 0 if successful, and >0 if an error occurred.
XX.SH SEE ALSO
XXsort(1), symcompact(1), symorder(1), uniq(1)
XX.SH BUGS
XXExecution speed leaves much to be desired - on a 11/73 it takes about
XX4 minutes to process the string table of the kernel.  Fortunately this
XXis only done once when the kernel is created.
XX.PP
XXAlthough
XX.B strcompact
XXmay be run on .o files as well as executables but this is probably not
XXworth the trouble since the linker will not create shared strings in the
XXfinal executable.
XSHAR_EOF
Xchmod 444 '/usr/src/man/man1/strcompact.1'
Xfi
Xif test -f '/usr/src/man/man1/symcompact.1'
Xthen
X	echo shar: "will not over-write existing file '/usr/src/man/man1/symcompact.1'"
Xelse
Xsed 's/^X//' << \SHAR_EOF > '/usr/src/man/man1/symcompact.1'
XX.\" Public domain 1994 - Steven Schultz
XX.\"
XX.\"	@(#)symcompact.1	1.0 (2.11BSD GTE) 1/25/94
XX.\"
XX.TH symcompact 1 "January 25, 1994"
XX.UC 2
XX.SH NAME
XXsymcompact \- string compaction for object files
XX.SH SYNOPSIS
XXsymcompact [ \fBobject_name\fP ... ]
XX.SH DESCRIPTION
XXsymcompact
XXreduces the symbol table size of an executable file.  This is done by
XXremoving unnecessary overlay transfer vectors (text symbols beginning with
XXa tilde).  In a nonoverlaid program there is no need for both the
XXunderscore (_foo) and tilde (~foo) text symbol and only the underscore
XXform is kept.  For overlaid programs
XXif the symbol is in the base segment the tilde form is not needed and again
XXonly the underscore form is preserved.  Running \fBsymcompact\fP typically
XXreduces the kernel symbol table size by 250 or so symbols.
XX.PP
XXIt is possible to run both \fBsymcompact\fP and \fBstrcompact\fP to
XXachieve an even higher degree of symbol and string table compaction.  The
XXnormal sequence is to run \fBsymcompact\fP first followed by \fBstrcompact\fP.
XXIf \fBsymcompact\fP runs out of memory it will be necessary to reverse the
XXorder and run \fBsymcompact\fP a second time - see the BUGS note below.
XX.PP
XXThe user must have write permission to the object/executable file.
XX.PP
XX.B
XXsymcompact
XXwrites to \fIstderr\fP the count of symbols removed from the symbol table.
XX.PP
XX.B
XXsymcompact
XXexits 0 if successful, and >0 if an error occurred.
XX.SH SEE ALSO
XXsymcompact(1), symorder(1)
XX.SH BUGS
XXThis program can partially negate the benefits of \fBstrcompact\fP because
XXmultiple references to identical strings cause additional strings to be
XXplaced in the string table.  Running \fBstrcompact\fP again after running
XXthis program fixes this problem.
XX.PP
XXThe \fIregister\fP local symbol type is removed from the executable/object
XXfile.  Since the debugger really doesn't know how to deal with those symbols
XXthis is not much of a loss and saves quite a bit of space both in the
XXsymbol table and the string table.
XX.PP
XX.B symcompact
XXshould not be run on .o files that will be passed to the linker.  The linker
XXwill need the tilde form of the symbol if an overlaid executable is being
XXcreated.
XSHAR_EOF
Xchmod 444 '/usr/src/man/man1/symcompact.1'
Xfi
Xexit 0
X#	End of shell archive
SHAR_EOF
fi
exit 0
#	End of shell archive
