9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Chris McGee <sirnewton_01@yahoo.ca>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] Linker and duplicate symbols
Date: Fri,  2 Sep 2016 11:56:24 -0400	[thread overview]
Message-ID: <9B2C4ECD-E92C-4C76-8678-74E26DBCD1CD@yahoo.ca> (raw)
In-Reply-To: <cfe9559c5cf8c4dce9795a019a52f733@hamnavoe.com>

Thanks Richard,

I tried outputting the echo of the ld command and it's linking all of the .5 files together along with the few archive files to produce the raw kernel file. I'll go hunting to see if there is some other unbound symbol.

I think the reason why I'm confused is that I don't understand how the linker can possibly pick the "right" symbol here given that C doesn't allow overloading. There are two sleep symbols. Why does the linker generally know to pick the one from the .5 file and not the one from the libc.a. Is it that the linker prefers a symbol from a .5 file over the .a file?

Chris

On Sep 2, 2016, at 6:20 AM, Richard Miller <9fans@hamnavoe.com> wrote:

>> I have recently run into a problem when compiling the kernel where the linker complains about duplicate symbols and fails. The symbol is sleep(), which is exported in libc.a but is also exported in another file in port, but with different parameters (both number and type).
> 
> Shouldn't happen (TM).  The duplicate sleep may be a side effect of
> some other error (undefined symbol?) which is getting ld confused.
> I suggest finding the invocation of ld (or $LD) in the mkfile and
> inserting a copy of the command with "echo" prepended, to see exactly
> what's being linked; then have a good look at all the error messages
> and see if there's anything obvious you can clear up which could make
> the duplicate sleep go away too.
> 
> Otherwise you could post the ld line and error messages to get more
> eyes looking at the problem ...
> 
> 




  reply	other threads:[~2016-09-02 15:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-02  2:34 Chris McGee
2016-09-02 10:20 ` Richard Miller
2016-09-02 15:56   ` Chris McGee [this message]
2016-09-02 16:11     ` Richard Miller
2016-09-09  0:48       ` Chris McGee
2016-09-09  8:31         ` Richard Miller
2016-09-09 14:55           ` Chris McGee
2016-09-09 16:37             ` Richard Miller
2016-09-02 16:12     ` cinap_lenrek
2016-09-02 20:00       ` Chris McGee
2016-09-02 22:34         ` Steve Simon
2016-09-03 16:58           ` Chris McGee

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=9B2C4ECD-E92C-4C76-8678-74E26DBCD1CD@yahoo.ca \
    --to=sirnewton_01@yahoo.ca \
    --cc=9fans@9fans.net \
    /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).