Date: Tue, 1 Feb 2011 10:03:49 -0800 From: Patrick Mahan <PMahan@adaranet.com> To: Anton Shterenlikht <mexas@bristol.ac.uk>, "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org> Subject: RE: same function name in multiple archives - bad idea? Message-ID: <32AB5C9615CC494997D9ABB1DB12783C024CC075B6@SJ-EXCH-1.adaranet.com> In-Reply-To: <20110201170757.GA5484@mech-cluster241.men.bris.ac.uk> References: <20110201170757.GA5484@mech-cluster241.men.bris.ac.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
> -----Original Message----- > From: owner-freebsd-questions@freebsd.org [mailto:owner-freebsd- > questions@freebsd.org] On Behalf Of Anton Shterenlikht > Sent: Tuesday, February 01, 2011 9:08 AM > To: freebsd-questions@freebsd.org > Subject: same function name in multiple archives - bad idea? > > Is it wrong to have functions with the same name > in multiple archives? E.g: > > % ar -t /usr/local/lib/libslatec.a | grep fdump.o > fdump.o > % ar -t /usr/local/lib/libcmlib.a | grep fdump.o > fdump.o > > Which "fdump" function will be used if I then link > against -larchive1.a -larchive2.a? > > And is there an easy way to find functions belonging > in multiple archives? > Anton, I believe for ELF images the linker will stop looking after finding it, so = the order of -l<library> controls which one will be used. If you want to see w= hich one was used during linking, use the ld options '-M -Map <mapfile> --cref' = which will create a map file with cross references. Patrick
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?32AB5C9615CC494997D9ABB1DB12783C024CC075B6>