The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Paul Winalski <paul.winalski@gmail.com>
To: Norman Wilson <norman@oclsc.org>
Cc: tuhs@tuhs.org
Subject: Re: [TUHS] Deleted lib1 and lib2 in v6, recoverable?
Date: Sun, 30 Dec 2018 14:24:55 -0500	[thread overview]
Message-ID: <CABH=_VTqZzNXPNecFCVZeqfMTnoJiWHbXZz-BriRGtxBY0J10Q@mail.gmail.com> (raw)
In-Reply-To: <1546196832.22954.for-standards-violators@oclsc.org>

On 12/30/18, Norman Wilson <norman@oclsc.org> wrote:
>
> Ld could all along have just made two passes through the
> library, one to assemble the same list ranlib did in advance,
> a second to load the files.  (Or perhaps a first pass to
> load what it knows it needs and assemble the list, and a
> second only if necessary.)

That would avoid the O(N**2) situation I described in a reply to this thread.

>  Presumably it didn't both to
> make ld simpler and because disk I/O was much slower back
> then (especially on a heavily-loaded time-sharing system,
> something far less common today).  I suspect it would work
> fine just to do it that way today.

Probably not.  For some reason linkers have always been notoriously
slow when compared to other parts of the compilation toolchain.  I
suspect it's because of all the I/O involved.

> Nowadays ranlib is no longer a separate program: ar
> recognizes object files and maintains an index if any are
> present.  I never especially liked that; ar is in
> principle a general tool so why should it have a special
> case for one type of file?  But in practice I don't know
> anyone who uses ar for anything except libraries any more
> (everyone uses tar for the general case, since it does a
> better job).

As you say, nobody these days uses ar for anything except object
module libraries.  And just about anything you do that modifies an ar
library will require re-running ranlib afterwards.  So as a
convenience and as a way to avoid cockpit errors, it makes sense to
merge the ranlib function into ar.  MacOS still uses an independent
ranlib, and it's a pain in the butt to have to remember to run ranlib
after each time you modify an archive.


>  Were I to wave flags over the matter I'd
> rather push to ditch ar entirely save for compatibility
> with the past, move to using tar rather than ar for object
> libraries, and let ld do two passes when necessary rather
> than requiring that libraries be specially prepared.  As
> I say, I think modern systems are fast enough that that
> would work fine.

The tar file format isn't as compact as ar's, since it operates on
fixed-size blocks.  Nowadays that wouldn't be a problem, but it
certainly was when disks were small, given that object modules very
often would be significantly smaller than a ranlib block.  Making two
passes over the entire library might be OK if the file system caches
file contents, but it would still require at least one complete scan
of the library, whereas if you have an index of global symbols, you
just have to process that index (and, of course, the modules you
finally decide to load).  As I said earlier, linkers are slow enough
as is--we don't need anything to make them less efficient.

-Paul W.

  reply	other threads:[~2018-12-30 19:25 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-30 19:07 Norman Wilson
2018-12-30 19:24 ` Paul Winalski [this message]
2018-12-31  6:57 ` arnold
2019-01-02 13:54   ` Tony Finch
  -- strict thread matches above, loose matches on Subject: below --
2018-12-31  3:22 Rudi Blom
2018-12-31  2:28 Doug McIlroy
2018-12-31  3:34 ` Will Senn
2018-12-31  6:52   ` ron
2018-12-29 14:13 Noel Chiappa
2018-12-29  1:09 Noel Chiappa
2018-12-29  1:26 ` Will Senn
2018-12-29  1:35 ` Warren Toomey
     [not found]   ` <82e23dba-38a4-3ee4-e35a-6293b8eef749@gmail.com>
2018-12-29  4:59     ` Warren Toomey
2018-12-29 16:26       ` Clem Cole
2018-12-29 16:49         ` Warner Losh
2018-12-29 17:48           ` Clem cole
2018-12-30 18:34 ` Paul Winalski
2018-12-30 18:48   ` ron
2018-12-30 18:56     ` Warner Losh
2018-12-30 19:02     ` Paul Winalski
2018-12-31  0:00   ` Donald ODona
2018-12-31 17:51     ` Paul Winalski
2018-12-29  0:25 Will Senn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABH=_VTqZzNXPNecFCVZeqfMTnoJiWHbXZz-BriRGtxBY0J10Q@mail.gmail.com' \
    --to=paul.winalski@gmail.com \
    --cc=norman@oclsc.org \
    --cc=tuhs@tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).