From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris McGee Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) Message-Id: <9B2C4ECD-E92C-4C76-8678-74E26DBCD1CD@yahoo.ca> Date: Fri, 2 Sep 2016 11:56:24 -0400 References: In-Reply-To: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Subject: Re: [9fans] Linker and duplicate symbols Topicbox-Message-UUID: 9c4b5158-ead9-11e9-9d60-3106f5b1d025 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 f= ile. 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 linke= r can possibly pick the "right" symbol here given that C doesn't allow overl= oading. There are two sleep symbols. Why does the linker generally know to p= ick 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 li= nker complains about duplicate symbols and fails. The symbol is sleep(), whi= ch is exported in libc.a but is also exported in another file in port, but w= ith different parameters (both number and type). >=20 > 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. >=20 > Otherwise you could post the ld line and error messages to get more > eyes looking at the problem ... >=20 >=20