From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25433 invoked by alias); 7 Jul 2009 16:11:57 -0000 Received: (qmail 25423 invoked by uid 22791); 7 Jul 2009 16:11:55 -0000 X-SWARE-Spam-Status: No, hits=-3.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 07 Jul 2009 16:11:41 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MODGY-0001Hd-JJ for gdb-patches@sources.redhat.com; Tue, 07 Jul 2009 16:11:34 +0000 Received: from enigma.qnx.com ([209.226.137.106]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 07 Jul 2009 16:11:34 +0000 Received: from aristovski by enigma.qnx.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 07 Jul 2009 16:11:34 +0000 To: gdb-patches@sources.redhat.com From: Aleksandar Ristovski Subject: [patch] solib do not add ldd if in libc Date: Tue, 07 Jul 2009 16:11:00 -0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030605040805040701030601" User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) 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/msg00199.txt.bz2 This is a multi-part message in MIME format. --------------030605040805040701030601 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 532 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. Thanks, -- Aleksandar Ristovski QNX Software Systems * solib-svr4.c (svr4_current_sos): Do not add dynamic linker to solist if already added. --------------030605040805040701030601 Content-Type: text/x-patch; name="solib-svr4-ldsomap-20090707.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="solib-svr4-ldsomap-20090707.diff" Content-length: 899 Index: gdb/solib-svr4.c =================================================================== RCS file: /cvs/src/src/gdb/solib-svr4.c,v retrieving revision 1.104 diff -u -p -r1.104 solib-svr4.c --- gdb/solib-svr4.c 2 Jul 2009 17:25:58 -0000 1.104 +++ gdb/solib-svr4.c 7 Jul 2009 16:04:04 -0000 @@ -1125,7 +1125,20 @@ svr4_current_sos (void) symbol information for the dynamic linker is quite crucial for skipping dynamic linker resolver code. */ if (lm == 0 && ldsomap == 0) - lm = ldsomap = solib_svr4_r_ldsomap (info); + { + struct so_list *so = head; + + lm = ldsomap = solib_svr4_r_ldsomap (info); + + /* On some other systems, dynamic linker resides in libc. + Make sure we do not add duplicated entry for it. */ + while (so) + { + if (so->lm_info->lm_addr == lm) + lm = ldsomap = 0; + break; + } + } discard_cleanups (old_chain); } --------------030605040805040701030601--