[comp.os.minix] 1.5.3 library order

cwr@pnet01.cts.com (Will Rose) (02/25/90)

I've managed to put together a 1.5.3 library order that will compile all
the commands, including those in the sub-directories, but it was not as 
straightforward as I hoped.  Certainly, on a XT with 640K the sequence
ar q libc.a `lorder *s | tsort` runs out of memory, with all three
programs producing "arg list too long" messages.  This is with ar set
to its maximum stack, and lorder and tsort set to 32K and 16K stacks
respectively.
 
Robert Hall (rhall@nosc.mil) sent me a message as to how a library order
might be built, and I used his algorithm:
 
First, find all the primitive functions, those that call no others. Rhall
suggested the script: sed -e 's/ .*//' lorder.out | uniq -u primitives.
If lorder.out is the file got from running lorder on an unordered archive,
the file "primitives" will contain the names of all the primitive functions.
 
The next step is to edit "lorder.out" and remove all lines that reference
primitive functions, which can be done either by hand, or by using a sed
or bawk script.
 
Then, run tsort on the edited lorder.out.  The final archive is built
in the order given by tsort.out, and the primitives then added to the end.
 
There is one 'gotcha'.  For some reason, lorder insists that memmove is
dependant on curses.  I could not, despite an awful lot of looking, find 
out why it thought this; I therefore added memmove to the primitives file,
and deleted it from the lorder.out file, and asld stopped complaining.
However, this incident did not increase my confidence in lorder.  Since
lorder worked for the (smaller) 1.3 library, and for the floating point
library, and it has all the stack space it needs, I suspect the problem
is that some internal table is becoming over-full.  But I don't have the
skill to find out more.
 
For those that don't want to go through this fan-dance, I've appended my
library order below.  It includes the new, fast, string library.  If you
use this, you may need to explicitly delete the orginal memcpy, since
the new version is inculuded in memmove.
 
The only problems compiling the libraries were in Other/doprintf and
printk each of which produced eight "incompatible pointer" warnings, and
Ansi/sincos which produced a "dummy fp constant" warning.
 
In the commands, fsck, ps and zmodem all needed the compiler passes set to
maximum stack.  Compress gave a "long to pointer" warning, and kermit
gave five or so miscellaneous warnings.
 
There is *no way* to link kermit on an PC or XT; could someone who can link
under MSDOS, or on a 386/sun/vax/cray *please* post a 1.5.3 binary suitable
for ordinary mortals?
 
Minix 1.5.3 liborder
 
_exit.s       
abs.s         
access.s      
adi.s         
amoeba.s      
assert.s      
atol.s        
bcmp.s        
bsearch.s     
bzero.s       
chmod.s       
chown.s       
chroot.s      
cii.s         
crypt.s       
ctermid.s     
ctime.s       
curses.s      
cuserid.s     
cuu.s         
dup.s         
execlp.s      
execn.s       
ffs.s         
freopen.s     
ftell.s       
fwrite.s      
getcwd.s      
getegid.s     
getgid.s      
getgrent.s    
getlogin.s    
getopt.s      
getpass.s     
gets.s        
gtty.s        
iaar.s        
ilar.s        
index.s       
isar.s        
isatty.s      
itoa.s        
lfr6.s        
link.s        
lock.s        
lrand.s       
lsearch.s     
memccpy.s     
mkdir.s       
mkfifo.s      
mknod.s       
mon.s         
mount.s       
nlist.s       
pathconf.s    
peekpoke.s    
popen.s       
portio.s      
printk.s      
ptrace.s      
putenv.s      
puts.s        
qsort.s       
rck.s         
regexp.s      
regsub.s      
rename.s      
ret6.s        
rewinddir.s   
rmdir.s       
sbi.s         
scanf.s       
seekdir.s     
set.s         
setbuf.s      
setgid.s      
setuid.s      
sincos.s      
stb.s         
stderr.s      
stime.s       
strcoll.s     
strerror.s    
strhp.s       
strtol.s      
strtoul.s     
strxfrm.s     
stty.s        
swab.s        
sync.s        
sysconf.s     
syslib.s      
system.s      
telldir.s     
times.s       
tmpnam.s      
ttyname.s     
umask.s       
umount.s      
uniqport.s    
utime.s       
vsprintf.s    
sprintf.s     
termcap.s     
fgets.s       
geteuid.s     
getenv.s      
chdir.s       
rindex.s      
getpwent.s    
atoi.s        
getuid.s      
prints.s      
unknown.s     
fprintf.s     
doprintf.s    
sleep.s       
alarm.s       
pause.s       
unlink.s      
bcopy.s       
fopen.s       
creat.s       
fread.s       
fseek.s       
fpathconf.s   
dup2.s        
fclose.s      
fdopen.s      
pipe.s        
fputs.s       
fgetc.s       
ungetc.s      
error.s       
fakfp.s       
lfr8.s        
ret8.s        
perror.s      
ioctl.s       
csb2.s        
csa2.s        
fat.s         
stop.s        
trp.s         
exec.s        
fork.s        
signal.s      
catchsig.s    
wait.s        
mktemp.s      
closedir.s    
opendir.s     
close.s       
malloc.s      
abort.s       
kill.s        
brk.s         
open.s        
readdir.s     
getdents.s    
fstat.s       
lseek.s       
read.s        
stat.s        
getpid.s      
rand.s        
time.s        
fputc.s       
cleanup.s     
fflush.s      
exit.s        
write.s       
call.s        
_dup.s        
and.s         
blm.s         
brksize.s     
cmi4.s        
cms.s         
cmu4.s        
com.s         
ctype.s       
dvi4.s        
dvu4.s        
errno.s       
exg.s         
getutil.s     
gto.s         
inn.s         
ior.s         
lar2.s        
loi.s         
memchr.s      
memcmp.s      
memmove.s     
memset.s      
message.s     
mli4.s        
nop.s         
printdat.s    
retarea.s     
return.s      
rmi4.s        
rmu4.s        
sar2.s        
sendrec.s     
setjmp.s      
sti.s         
strcat.s      
strchr.s      
strcmp.s      
strcpy.s      
strcspn.s     
strlen.s      
strncat.s     
strncmp.s     
strncpy.s     
strpbrk.s     
strrchr.s     
strspn.s      
strstr.s      
strtok.s      
vars.s        
vectab.s      
xor.s         
 
-----------------------------------------------------------------------
"If heaven too had passions  | Will Rose
     even heaven would       | UUCP: {nosc ucsd hplabs!hp-sdd}!crash!pnet01!cw
     grow old."  -  Li Ho.   | ARPA: crash!pnet01!cwr@nosc.mil
                             | INET: cwr@pnet01.cts.com


UUCP: {nosc ucsd hplabs!hp-sdd}!crash!pnet01!cwr
ARPA: crash!pnet01!cwr@nosc.mil
INET: cwr@pnet01.cts.com

nfs@notecnirp.Princeton.EDU (Norbert Schlenker) (02/26/90)

In article <1659@crash.cts.com> cwr@pnet01.cts.com (Will Rose) writes:
>I've managed to put together a 1.5.3 library order that will compile all
>the commands, including those in the sub-directories, but it was not as 
>straightforward as I hoped...
>...
>Robert Hall (rhall@nosc.mil) sent me a message as to how a library order
>might be built, and I used his algorithm:
>[long description deleted]
>... 
>For those that don't want to go through this fan-dance, I've appended my
>library order below.  It includes the new, fast, string library.  If you
>use this, you may need to explicitly delete the orginal memcpy, since
>the new version is included in memmove.
>...
>[Will Rose's library order deleted]

Until lorder and tsort are fixed (and maybe even after that), I think
the following approach is better.  It isn't better because it requires
less work - it's better because it makes more sense.

Here is the Makefile that I used under v1.4b to build libc.a.  I
modified it slightly for v1.5.0, but it probably needs to be updated
for v1.5.3, because there are many new routines.  I'd do it myself,
but I have my own peculiar library (POSIX compatible and with my stdio
routines) so the routine names don't match the ones distributed with
1.5.x.  Surely some kind soul will be willing to update this for 1.5.3.

Finally, how about something along these lines in future distributions?
I vote for no more library order problems!

Norbert

--------------------------------------------------------------------------
AMOEBA = amoeba.s uniqport.s

CURSES = curses.s termcap.s

REGEXP = regexp.s regsub.s

MISCELLANEOUS = \
	crypt.s execn.s ffs.s getopt.s getpass.s gtty.s \
	itoa.s lock.s lrand.s lsearch.s memccpy.s mktemp.s peekpoke.s \
	popen.s portio.s putenv.s stderr.s stty.s swab.s syslib.s \
	seekdir.s telldir.s

NOT_QUITE_STDIO = printk.s prints.s

POSIX_OHHELL = utime.s

ASSERT = assert.s

STRERROR = strerror.s

TIME =	ctime.s time.s

STDIO = fclose.s fopen.s freopen.s \
	scanf.s \
	fgets.s fread.s gets.s fgetc.s ungetc.s \
	fprintf.s sprintf.s vsprintf.c doprintf.s \
	perror.s \
	fputs.s fwrite.s fputc.s \
	fseek.s ftell.s setbuf.s tmpnam.s \
	cleanup.s fflush.s \
	rename.s \
	printdat.s

STDLIB_OUT_OF_ORDER = abort.s system.s

POSIX_OUT_OF_ORDER = \
	execlp.s exec.s \
	getcwd.s \
	getlogin.s \
	getdents.s getgrent.s getpwent.s \
	ttyname.s \
	closedir.s opendir.s readdir.s rewinddir.s \
	pathconf.s fpathconf.s \
	sleep.s

POSIX = \
	_exit.s \
	access.s alarm.s \
	chdir.s chmod.s chown.s close.s creat.s \
	ctermid.s cuserid.s \
	dup.s dup2.s \
	fdopen.s fork.s fstat.s \
	getegid.s geteuid.s getgid.s \
	getgroups.s getpid.s getppid.s \
	getuid.s \
	isatty.s \
	kill.s \
	link.s lseek.s \
	mkfifo.s \
	open.s \
	pause.s pipe.s \
	read.s \
	setgid.s setuid.s stat.s sysconf.s \
	times.s \
	umask.s unlink.s \
	wait.s write.s

MEMORY_ALLOCATION = malloc.s

UNIX = \
	brk.s chroot.s ioctl.s mknod.s mount.s \
	ptrace.s stime.s sync.s umount.s

STDLIB = \
	abs.s atexit.s atoi.s atol.s \
	bsearch.s div.s getenv.s \
	labs.s ldiv.s qsort.s rand.s \
	strtol.s strtoul.s
	
CTYPE = ctype.s

SETJMP = setjmp.s

SIGNAL = signal.s catchsig.s

COMPILER_INTERNAL = \
	adi.s and.s blm.s cii.s cmi4.s cms.s cmu4.s com.s csa2.s csb2.s \
	cuu.s _dupl.s dvi4.s dvu4.s exg.s fakfp.s gto.s iaar.s ilar.s \
	inn.s ior.s isar.s lar2.s loi.s mli4.s mon.s nop.s rck.s \
	rmi4.s rmu4.s sar2.s sbi.s set.s sti.s strhp.s xor.s \
	ret6.s ret8.s lfr6.s lfr8.s retarea.s return.s stb.s

COMPILER_TRAP = unknown.s fat.s trp.s vars.s

EXIT = stop.s exit.s

MINIX_INTERFACE = call.s sendrec.s message.s

NON_STANDARD_STRING = \
	bcmp.s bcopy.s bzero.s \
	index.s rindex.s

STRING = \
	memchr.s memcmp.s memmove.s memset.s \
	strcoll.s strxfrm.s \
	strstr.s strcat.s strchr.s strcmp.s strcpy.s strcspn.s strlen.s \
	strncat.s strncmp.s strncpy.s strpbrk.s strrchr.s strspn.s strtok.s

ANSI_COMMON = errno.s

libc.a: $(AMOEBA)
libc.a: $(CURSES)
libc.a: $(REGEXP)
libc.a: $(MISCELLANEOUS)
libc.a: $(NOT_QUITE_STDIO)
libc.a: $(POSIX_OHHELL)
libc.a: $(ASSERT)
libc.a: $(STRERROR)
libc.a: $(STDIO)
libc.a: $(STDLIB_OUT_OF_ORDER)
libc.a: $(TIME)
libc.a: $(POSIX_OUT_OF_ORDER)
libc.a: $(POSIX)
libc.a: $(MEMORY_ALLOCATION)
libc.a: $(UNIX)
libc.a: $(STDLIB)
libc.a: $(CTYPE)
libc.a: $(SETJMP)
libc.a: $(SIGNAL)
libc.a: $(COMPILER_INTERNAL)
libc.a: $(COMPILER_TRAP)
libc.a: $(EXIT)
libc.a: $(MINIX_INTERFACE)
libc.a: $(NON_STANDARD_STRING)
libc.a: $(STRING)
libc.a: $(ANSI_COMMON)
	ar q libc.a $(AMOEBA)
	ar q libc.a $(CURSES)
	ar q libc.a $(REGEXP)
	ar q libc.a $(MISCELLANEOUS)
	ar q libc.a $(NOT_QUITE_STDIO)
	ar q libc.a $(POSIX_OHHELL)
	ar q libc.a $(ASSERT)
	ar q libc.a $(STRERROR)
	ar q libc.a $(STDIO)
	ar q libc.a $(STDLIB_OUT_OF_ORDER)
	ar q libc.a $(TIME)
	ar q libc.a $(POSIX_OUT_OF_ORDER)
	ar q libc.a $(POSIX)
	ar q libc.a $(MEMORY_ALLOCATION)
	ar q libc.a $(UNIX)
	ar q libc.a $(STDLIB)
	ar q libc.a $(CTYPE)
	ar q libc.a $(SETJMP)
	ar q libc.a $(SIGNAL)
	ar q libc.a $(COMPILER_INTERNAL)
	ar q libc.a $(COMPILER_TRAP)
	ar q libc.a $(EXIT)
	ar q libc.a $(MINIX_INTERFACE)
	ar q libc.a $(NON_STANDARD_STRING)
	ar q libc.a $(STRING)
	ar q libc.a $(ANSI_COMMON)