From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16828 invoked by alias); 20 Jan 2012 23:01:16 -0000 Received: (qmail 16815 invoked by uid 22791); 20 Jan 2012 23:01:15 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,TW_KP,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.digium.com (HELO mail.digium.com) (216.207.245.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 20 Jan 2012 23:01:02 +0000 Received: from [10.24.55.203] (helo=zimbra.hsv.digium.com) by mail.digium.com with esmtp (Exim 4.69) (envelope-from ) id 1RoNSA-00022R-4T; Fri, 20 Jan 2012 17:01:02 -0600 Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra.hsv.digium.com (Postfix) with ESMTP id 25F19D8004; Fri, 20 Jan 2012 17:01:02 -0600 (CST) Received: from zimbra.hsv.digium.com ([127.0.0.1]) by localhost (zimbra.hsv.digium.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NT-gGM1we8E8; Fri, 20 Jan 2012 17:01:01 -0600 (CST) Received: from [10.24.250.46] (unknown [10.24.250.46]) by zimbra.hsv.digium.com (Postfix) with ESMTPSA id 7FC75D8002; Fri, 20 Jan 2012 17:01:01 -0600 (CST) Message-ID: <4F19F22C.3010004@digium.com> Date: Fri, 20 Jan 2012 23:01:00 -0000 From: "Kevin P. Fleming" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111124 Thunderbird/8.0 MIME-Version: 1.0 To: Cary Coutant CC: binutils@sourceware.org Subject: Re: Ensuring symbol resolution order at runtime References: <4F19C1B0.8080601@digium.com> <4F19EF05.7020104@digium.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2012-01/txt/msg00217.txt.bz2 On 01/20/2012 04:57 PM, Cary Coutant wrote: >>> As long as the runtime loader sees the same libraries that the linker >>> saw, yes, there is a guarantee. However, if lib1.so is replaced with a >>> library that does not define "foo", then the dynamic loader will bind >>> "foo" to the definition in lib2.so without any complaint. >> >> So, to be as specific as I can, not only will the runtime loader see those >> same libraries, but it will look at them in the *same order* that the static >> linker did (presumably because the static linker will list them in the >> linked executable in the order it processed them, and the dynamic linker >> follows that order). > > Yes. The ABI requires that: > > "When the dynamic linker creates the memory segments for an object > file, the dependencies (recorded in DT_NEEDED entries of the dynamic > structure) tell what shared objects are needed to supply the program's > services. By repeatedly connecting referenced shared objects and their > dependencies, the dynamic linker builds a complete process image. When > resolving symbolic references, the dynamic linker examines the symbol > tables with a breadth-first search. That is, it first looks at the > symbol table of the executable program itself, then at the symbol > tables of the DT_NEEDED entries (in order), and then at the second > level DT_NEEDED entries, and so on. Shared object files must be > readable by the process; other permissions are not required." [from > http://www.sco.com/developers/gabi/latest/ch5.dynamic.html#shobj_dependencies > ] Thank you very much for the help; the ABI documentation reference is especially helpful. -- Kevin P. Fleming Digium, Inc. | Director of Software Technologies Jabber: kfleming@digium.com | SIP: kpfleming@digium.com | Skype: kpfleming 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA Check us out at www.digium.com & www.asterisk.org