From owner-freebsd-questions@FreeBSD.ORG Fri Aug 19 20:19:51 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4D17116A41F for ; Fri, 19 Aug 2005 20:19:51 +0000 (GMT) (envelope-from jcm@FreeBSD-uk.eu.org) Received: from yearning.mcc.ac.uk (yearning.mcc.ac.uk [130.88.203.23]) by mx1.FreeBSD.org (Postfix) with ESMTP id D9EE143D46 for ; Fri, 19 Aug 2005 20:19:50 +0000 (GMT) (envelope-from jcm@FreeBSD-uk.eu.org) Received: from dogma.freebsd-uk.eu.org ([130.88.200.97]) by yearning.mcc.ac.uk with esmtp (Exim 4.51 (FreeBSD)) id 1E6DL9-0008yJ-5u; Fri, 19 Aug 2005 21:19:48 +0100 Received: from dogma.freebsd-uk.eu.org (localhost [127.0.0.1]) by dogma.freebsd-uk.eu.org (8.13.1/8.13.1) with ESMTP id j7JKJksU079057; Fri, 19 Aug 2005 21:19:46 +0100 (BST) (envelope-from jcm@dogma.freebsd-uk.eu.org) Received: (from jcm@localhost) by dogma.freebsd-uk.eu.org (8.13.1/8.12.6/Submit) id j7JKJjXF079056; Fri, 19 Aug 2005 21:19:45 +0100 (BST) Date: Fri, 19 Aug 2005 21:19:45 +0100 From: Jonathon McKitrick To: Giorgos Keramidas Message-ID: <20050819201945.GA79032@dogma.freebsd-uk.eu.org> References: <20050819191335.GA76538@dogma.freebsd-uk.eu.org> <20050819194748.GA7138@flame.pc> <20050819200338.GA77739@dogma.freebsd-uk.eu.org> <20050819201440.GA9246@flame.pc> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050819201440.GA9246@flame.pc> User-Agent: Mutt/1.4i Cc: freebsd-questions@freebsd.org Subject: Re: Forcing symbol resolution in lib rather than bin 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: Fri, 19 Aug 2005 20:19:51 -0000 On Fri, Aug 19, 2005 at 11:14:40PM +0300, Giorgos Keramidas wrote: : > Doesn't ld *statically* link code from .a archives? : : 'statically' is such an overloaded term I prefer to avoid using it. : : The C linker will include the body of functions defined in non-shared : libraries into every shared object that references them, AFAIK. This is : obvious if you run nm(1) on libbar.so of the example above, because the : libfoo_init() function is listed as 'T'. I think that's what you want : by making the libfoo.a library non-shared in the first place. I can see from nm(1) that the function I want is there ('T'). And reading about ld(1) talks about the '-(' option for searching the .a archives until there are no unresolved symbols. But it still doesn't find mine unless I link it with the binary, not the calling shared object. Jonathon McKitrick -- Hoppiness is a good beer.