Subject: Re: Compiler weirdness.
To: Ben Harris <bjh21@netbsd.org>
From: Greywolf <greywolf@starwolf.com>
List: tech-toolchain
Date: 04/03/2003 14:43:37
Thus spake Ben Harris ("BH> ") sometime Today...

BH> >Note that the symbol is found via nm in one of the libs, and said lib is
BH> >specified prior to the lib which references said symbol.
BH>
BH> I think this is your problem.  ld collects the list of unresolved
BH> symbols as it goes along, and when it gets to a new object file, it
BH> tries to resolve all the unresolved symbols on its list.  If that
BH> object file's in a static library, it only bothers including it in the
BH> link if it resolves a previously-unresolved reference.  Presumably the
BH> object that contains the symbol you want didn't get included, because
BH> it wasn't unresolved when that library was searched.  Hence, you need
BH> to shuffle the libraries around on your link line.

It didn't seem to be resolved anywhere else; I had to do

	nm -o /usr/local/lib/lib*.a /usr/X11/lib/lib*.a | grep ...

in order to find the lib in the first place, and it doesn't appear
to be resolved anywhere in the local .o files.

I'll go check again, but I'm still very puzzled.

BH> [ Oh, and the list you wanted was tech-toolchain ]

Noted; but since I'm not on it, could you please cc: me?  [I'll
be rectifying this shortly...]

				--*greywolf;
--
NetBSD: An Operating System For Everyone