help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linking with a static library.


From: Paul Pluzhnikov
Subject: Re: Linking with a static library.
Date: Thu, 27 Oct 2005 07:37:05 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

Simon Buchan <simon@hand-multimedia.co.nz> writes:

>>  http://webpages.charter.net/ppluzhnikov/linker.html
>
> However, I don't understand why it doesn't do the normal pass,
> grabbing all the object files et-al, and then if there are still
> undefined symbols, do the second pass (possibly with a warning).

Some "smarter" linkers do (e.g. the AIX one). This linker also does
"garbage collection" (selecting only referenced *parts* of the
objects, rather then the whole objects; i.e. making Xerox copies
of just some pages, rather than the whole book).

> Sure it's inefficient, but I think my time spent playing librarian is
> worth more than the computer's, 

It depends. Consider libFoo.a with 10MBytes of symbol table, from
which you want to pull just as single object via a single referenced
symbol. Assume the referenced object defines N symbols and doesn't
reference anything else.

Traditional UNIX linker will need (heap) space for just the one
symbol that is unresolved before libFoo.a is searched, and for
N symbols (in the "have" list) after the search.

The linker you are proposing will need 10MB of heap.

This can make a huge difference on a machine with 64K of RAM [1]:
the difference between being able to link the program easily, and
not being able to link it at all.

[1] Remember, UNIX is 35 years old. According to 
http://www.islandnet.com/~kpolsson/workstat/ :

1986
  IBM announces the IBM RT Personal Computer, using RISC-based
  technology from IBM's "801" project of the mid-70s. It is one of
  the first commercially-available 32-bit RISC-based computers. The
  base configuration has 1 MB RAM, a 1.2 MB floppy, and 40 MB hard
  drive, for US$11,700.

According to http://en.wikipedia.org/wiki/SPARCstation_1,
SPARCstation 1 had a *maximum* RAM of 64MB. I worked on SS1 with
16M of RAM in 1993. Our link times were in the 30-minute range
(that's with *traditional* UNIX linker; I can't imagine what it
would have been if the linker worked the "smart" way).

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]