From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4537 invoked by alias); 11 Jun 2004 14:45:41 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 4520 invoked from network); 11 Jun 2004 14:45:33 -0000 Received: from unknown (HELO dyn.fergaldaly.com) (212.13.198.240) by sourceware.org with SMTP; 11 Jun 2004 14:45:33 -0000 Received: from fergal by dyn.fergaldaly.com with local (Exim 3.35 #1 (Debian)) id 1BYnHa-0004UQ-00; Fri, 11 Jun 2004 15:45:26 +0100 Date: Fri, 11 Jun 2004 14:45:00 -0000 From: Fergal Daly To: gdb-patches@sources.redhat.com Subject: [PATCH] prevent core dump for multiple def symbols Message-ID: <20040611144526.GF16613@dyn.fergaldaly.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.28i X-SW-Source: 2004-06/txt/msg00258.txt.bz2 I have a .so file that makes gdb dump core. The problem shows up in bfd/linker.c:1800 if (! ((*info->callbacks->multiple_definition) (info, h->root.string, msec->owner, msec, mval, abfd, section, value))) return FALSE; because info->callbacks->multiple_definition is null. I have no idea if this patch is "the right thing" but it allows me to debug my app. It just sets the callback to a dummy callback which returns TRUE when the link_info is being created. I presume this is OK because all the other callbacks are set to dummies too. This was logged as bug 1668, hopefully this is a fix for it. Patch below, F --- ./bfd/simple.c.orig 2004-06-11 15:32:40.620497552 +0100 +++ ./bfd/simple.c 2004-06-11 15:18:42.043980560 +0100 @@ -78,6 +78,19 @@ return TRUE; } +static bfd_boolean +simple_dummy_multiple_definition (struct bfd_link_info *link_info ATTRIBUTE_UNUSED, + const char *name ATTRIBUTE_UNUSED, + bfd *obfd ATTRIBUTE_UNUSED, + asection *osec, + bfd_vma oval ATTRIBUTE_UNUSED, + bfd *nbfd ATTRIBUTE_UNUSED, + asection *nsec ATTRIBUTE_UNUSED, + bfd_vma nval ATTRIBUTE_UNUSED) +{ + return TRUE; +} + struct saved_output_info { bfd_vma offset; @@ -171,6 +184,7 @@ callbacks.reloc_overflow = simple_dummy_reloc_overflow; callbacks.reloc_dangerous = simple_dummy_reloc_dangerous; callbacks.unattached_reloc = simple_dummy_unattached_reloc; + callbacks.multiple_definition = simple_dummy_multiple_definition; memset (&link_order, 0, sizeof (link_order)); link_order.next = NULL;