From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12043 invoked by alias); 21 Jul 2009 15:12:19 -0000 Received: (qmail 12034 invoked by uid 22791); 21 Jul 2009 15:12:18 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from qnxmail.qnx.com (HELO qnxmail.qnx.com) (209.226.137.76) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 21 Jul 2009 15:12:13 +0000 Received: from Nebula.ott.qnx.com (nebula.ott.qnx.com [10.42.3.30]) by hub.ott.qnx.com (8.9.3/8.9.3) with ESMTP id LAA07178; Tue, 21 Jul 2009 11:12:03 -0400 Received: from [127.0.0.1] ([10.42.100.129]) by Nebula.ott.qnx.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 21 Jul 2009 11:12:07 -0400 Message-ID: <4A65DAB3.1040803@qnx.com> Date: Tue, 21 Jul 2009 15:40:00 -0000 From: Aleksandar Ristovski User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) MIME-Version: 1.0 To: Pedro Alves CC: gdb-patches@sources.redhat.com Subject: Re: [patch] solib do not add ldd if in libc References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-07/txt/msg00509.txt.bz2 Pedro, I am copying your reply here since my reply to myself contains better while loop which I actually wanted you to see. (and I'm replying to you below). > Aleksandar Ristovski wrote: >> Hello, >> >> On systems (QNX) that have ldd residing in libc, svr4_current_sos will >> add libc twice. Once while walking the linkmap and second time from >> r_ldsomap. >> >> This patch adds check if ldsolib has already been added and if so, >> prevents adding duplicate entry. >> >> >> Tested on linux - i386, no regressions; however, it would be good if >> someone could test for regressions on Solaris. >> > > This time with the right patch. > > > Pedro Alves wrote: > On Tuesday 07 July 2009 17:11:21, Aleksandar Ristovski wrote: > > [This is not a formal review, just a quick note: ] did you post the > patch you intended to post? That while loop looks wrong. > > I note that solib_svr4_r_ldsomap's describing comment seems to > indicate that a fix there would fit better with its design. > > /* Find the link map for the dynamic linker (if it is not in the > normal list of loaded shared objects). */ > > static CORE_ADDR > solib_svr4_r_ldsomap (struct svr4_info *info) > { > Our r_debug is version 2 and we do have r_ldsomap member. We set it to our dynamic linker which coincides with libc. My patch loops through the list of so-s and looks for already added object; if found, then resets ldsomap to prevent outer loop from doing another iteration. I, unfortunately, can not verify that it doesn't break solaris... I think it doesn't, but I couldn't test it (AFAIK, solaris has dynamic linker in a separate shared library and so it should not be found in the so list, but I don't have Solaris to verify this). Thanks, -- Aleksandar Ristovski QNX Software Systems