From owner-freebsd-questions@FreeBSD.ORG Tue Feb 1 18:21:46 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 970AF106564A for ; Tue, 1 Feb 2011 18:21:46 +0000 (UTC) (envelope-from PMahan@adaranet.com) Received: from barracuda.adaranet.com (smtp.adaranet.com [72.5.229.2]) by mx1.freebsd.org (Postfix) with ESMTP id 784C68FC14 for ; Tue, 1 Feb 2011 18:21:46 +0000 (UTC) X-ASG-Debug-ID: 1296583430-5549676a0001-jLrpzn Received: from SJ-EXCH-1.adaranet.com ([10.10.1.29]) by barracuda.adaranet.com with ESMTP id YCPCfgjNlPFxVOjf; Tue, 01 Feb 2011 10:03:50 -0800 (PST) X-Barracuda-Envelope-From: PMahan@adaranet.com Received: from SJ-EXCH-1.adaranet.com ([fe80::7042:d8c2:5973:c523]) by SJ-EXCH-1.adaranet.com ([fe80::7042:d8c2:5973:c523%14]) with mapi; Tue, 1 Feb 2011 10:03:50 -0800 From: Patrick Mahan X-Barracuda-BBL-IP: fe80::7042:d8c2:5973:c523 X-Barracuda-RBL-IP: fe80::7042:d8c2:5973:c523 To: Anton Shterenlikht , "freebsd-questions@freebsd.org" Date: Tue, 1 Feb 2011 10:03:49 -0800 X-ASG-Orig-Subj: RE: same function name in multiple archives - bad idea? Thread-Topic: same function name in multiple archives - bad idea? Thread-Index: AcvCMr2LsscjCzvGRdWK4N5ORAS20QABvO7A Message-ID: <32AB5C9615CC494997D9ABB1DB12783C024CC075B6@SJ-EXCH-1.adaranet.com> References: <20110201170757.GA5484@mech-cluster241.men.bris.ac.uk> In-Reply-To: <20110201170757.GA5484@mech-cluster241.men.bris.ac.uk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Barracuda-Connect: UNKNOWN[10.10.1.29] X-Barracuda-Start-Time: 1296583430 X-Barracuda-URL: http://172.16.10.203:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at adaranet.com Cc: Subject: RE: same function name in multiple archives - bad idea? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Feb 2011 18:21:46 -0000 > -----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 controls which one will be used. If you want to see w= hich one was used during linking, use the ld options '-M -Map --cref' = which will create a map file with cross references. Patrick