[comp.unix.programmer] Question on improving link speed: ld -r vs. ar

montnaro@spyder.crd.ge.com (Skip Montanaro) (02/26/91)

I have a program that is built by linking from 10 to 30 libraries,
selectable at build time. Each library contains from five to 50 object
modules. Each object module has two externally visible symbols, the rest
being static. Each library has an interface function that stitches the
visible symbols into a lookup table for run-time function access

I'm toying with the idea of switching from a set of libraries built using ar
to a set of object modules built using ld -r to improve link speed.
Presumably, most of the symbol resolution will be done during the relatively
infrequent ld -r steps, and much less in the more frequent final link.
Before I rip my makefiles to shreds, I have a couple of questions.

	1. Given the restricted number of visible symbols in each module, is
	   it likely to improve link speeds?

	2. How widely available is the -r flag to ld? I looked around a
	   number of machines on which we currently support our software,
	   and it seems to be on all of them (Sun, Stellar, HP 9000/300,
	   SGI), but I'm hesitant about future ports.

Thanks,

--
Skip (montanaro@crdgw1.ge.com)

ooms@delgeo.nl (Frank Ooms) (02/28/91)

In article <MONTNARO.91Feb26093958@spyder.crd.ge.com> montanaro@crdgw1.ge.com (Skip Montanaro) writes:
> [ ... ]
>	1. Given the restricted number of visible symbols in each module, is
>	   it likely to improve link speeds?

We have used this scheme for some time with a set of libraries and saw
an improvement of only 10%. The total size of the libraries is in the
order of 10 Mbytes, with about 6000 routines.

The major drawback of this scheme is that is difficult to replace one
routine with a private version for testing purposes, since that will
result in multiply defined symbols.

>
>	2. How widely available is the -r flag to ld? I looked around a
>	   number of machines on which we currently support our software,
>	   and it seems to be on all of them (Sun, Stellar, HP 9000/300,
>	   SGI), but I'm hesitant about future ports.
>

Well we have it (ConvexOS V8.1) on our BSD derived system. They claim
POSIX compliability, so if this option is POSIX it will probably stay
for a while.

Cheers,
-- 
	/*	    Frank Ooms,   +31 15-621554			*
	 *		  ooms@delgeo.nl			*
 	 *	    ..!mcsun!hp4nl!delgeo!ooms			*/