From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19653 invoked by alias); 27 Mar 2013 22:09:11 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org Received: (qmail 19529 invoked by uid 89); 27 Mar 2013 22:08:58 -0000 X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,SPF_NEUTRAL autolearn=no version=3.3.1 X-Spam-User: qpsmtpd, 2 recipients Received: from popelka.ms.mff.cuni.cz (HELO popelka.ms.mff.cuni.cz) (195.113.20.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 27 Mar 2013 22:08:54 +0000 Received: from domone.kolej.mff.cuni.cz (popelka.ms.mff.cuni.cz [195.113.20.131]) by popelka.ms.mff.cuni.cz (Postfix) with ESMTPS id F034662A6C; Wed, 27 Mar 2013 23:08:49 +0100 (CET) Received: by domone.kolej.mff.cuni.cz (Postfix, from userid 1000) id 156166045C; Wed, 27 Mar 2013 23:04:19 +0100 (CET) Date: Wed, 27 Mar 2013 22:09:00 -0000 From: =?utf-8?B?T25kxZllaiBCw61sa2E=?= To: dhatch at ilm dot com Cc: glibc-bugs@sourceware.org Subject: Re: [Bug dynamic-link/15311] New: _dl_sort_fini static deps can be violated by dynamic ones Message-ID: <20130327220418.GA4410@domone.kolej.mff.cuni.cz> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-SW-Source: 2013-03/txt/msg00153.txt.bz2 On Wed, Mar 27, 2013 at 07:49:25AM +0000, dhatch at ilm dot com wrote: > http://sourceware.org/bugzilla/show_bug.cgi?id=15311 > > Bug #: 15311 > Summary: _dl_sort_fini static deps can be violated by dynamic > ones > Product: glibc > Version: unspecified > Status: NEW > Severity: normal > Priority: P2 > Component: dynamic-link > AssignedTo: unassigned@sourceware.org > ReportedBy: dhatch@ilm.com > Classification: Unclassified > > > _dl_sort_fini tries to honor static dependencies > at the expense of relocation (dynamic) dependencies, when there is a conflict. > But the code that does this is rather half-hearted-- > it only ignores a dynamic dependency > if the dynamic dependency directly contradicts > a single static dependency, per the following comment > in the loop over dynamic dependencies in elf/dl-fini.c: > /* If a cycle exists with a link time dependency, > preserve the latter. */ > > In even slightly more complex situations, > e.g. a mixed cycle of length 3 (consisting of at least one > static and at least one dynamic dependency), > no preference is given to the static dep(s); > the cycle is broken arbitrarily and so the static dep may be violated, > even if there are no cycles at all in the static dependency graph. > > If static dependencies really are more important than dynamic ones, > it might be a good idea to give them preference in a more principled way. > > If the sorting routine gets overhauled > (as I think it needs to be, due to currently absurd asymptotic behavior, > see bug 15310) > it would be good to keep this in mind. > If you do topologic sort it should suffice to take static dependency edges before dynamic ones, it assures that static when static are acyclic then they are always correctly ordered.