The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Paul Winalski <paul.winalski@gmail.com>
To: Donald ODona <mutiny.mutiny@india.com>
Cc: tuhs@minnie.tuhs.org, Noel Chiappa <jnc@mercury.lcs.mit.edu>
Subject: Re: [TUHS] Deleted lib1 and lib2 in v6, recoverable?
Date: Mon, 31 Dec 2018 12:51:05 -0500	[thread overview]
Message-ID: <CABH=_VRZu7QoodVTdeVzGcJMetmpOoKumAgYXFhMb+aeyh1DtQ@mail.gmail.com> (raw)
In-Reply-To: <401865440.113885.1546214417318.JavaMail.tomcat@india-live-be01>

On 12/30/18, Donald ODona <mutiny.mutiny@india.com> wrote:
>
>
> At 30 Dec 2018 18:35:22 +0000 (+00:00) from Paul Winalski
> <paul.winalski@gmail.com>:
>>
>> Sometimes one runs into a situation where a module loaded from lib1.a
>> has an undefined symbol that causes a module from lib2.a to be loaded,
>> and that module in turn has an undefined symbol that is defined in
>> lib1.a.  In that case, you have to cause the linker to scan lib1.a
>> twice:
>>
>>     ld main.o lib1.a lib2.a lib1.a
>>
> thats not true, because the M$ and borland linkers of the 80ths under
> MSDOS(sic!) already processed indexed libraries. Therefore the multiple
> inclusion of libraries wans'nt needed.
>
No, you still need multiple inclusion in that situation.  Consider
this situation:

main.o has an undefined reference to s1
m1.o in lib1.a defines s1 and has an undefined reference to s2
m3.o in lib1.a defines s3
m2.o in lib2.a defines s2 and has an undefined reference to s3

The command line is:  ld main.o lib1.a lib2.a

The linker makes one or more passes over the index of lib1.a until no
more symbols are resolved.  The linker loads m1.o.  It does not load
m3.o because m3.o doesn't resolve any outstanding undefined
references.

The linker still has s2 undefined.  It now makes one or more passes
over the index of lib2.a until no more symbols are resolved.  In the
process it loads m2.o to resolve s2 and adds s3 to the list of
unresolved symbols.

After lib2.a is processed, s3 is still undefined, and ld has nothing
left to process.  ld will issue an "unresolved symbol" error message
for s3.  You need to specify lib1.a a second time to cause ld to scan
it again.

-Paul W.

  reply	other threads:[~2018-12-31 17:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
  -- 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-30 19:07 Norman Wilson
2018-12-30 19:24 ` Paul Winalski
2018-12-31  6:57 ` arnold
2019-01-02 13:54   ` Tony Finch
2018-12-29 14:13 Noel Chiappa
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=_VRZu7QoodVTdeVzGcJMetmpOoKumAgYXFhMb+aeyh1DtQ@mail.gmail.com' \
    --to=paul.winalski@gmail.com \
    --cc=jnc@mercury.lcs.mit.edu \
    --cc=mutiny.mutiny@india.com \
    --cc=tuhs@minnie.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).