From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28085 invoked by alias); 22 Jul 2009 00:12:52 -0000 Received: (qmail 28065 invoked by uid 22791); 22 Jul 2009 00:12:51 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.45.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 22 Jul 2009 00:12:39 +0000 Received: from zps38.corp.google.com (zps38.corp.google.com [172.25.146.38]) by smtp-out.google.com with ESMTP id n6M0Cb8c026053 for ; Tue, 21 Jul 2009 17:12:37 -0700 Received: from localhost (ppluzhnikov.mtv.corp.google.com [172.18.118.92]) by zps38.corp.google.com with ESMTP id n6M0CXFq031460; Tue, 21 Jul 2009 17:12:34 -0700 Received: by localhost (Postfix, from userid 74925) id C049876BC0; Tue, 21 Jul 2009 17:12:33 -0700 (PDT) To: gdb-patches@sourceware.org Cc: ppluzhnikov@google.com Subject: [RFC][patch] Work around for gold/10400 bug. Message-Id: <20090722001233.C049876BC0@localhost> Date: Wed, 22 Jul 2009 08:55:00 -0000 From: ppluzhnikov@google.com (Paul Pluzhnikov) 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/msg00531.txt.bz2 Greetings, Perhaps I am jumping the gun here, but I'd like some comments on this patch as well. The patch below is on top of my earlier 'speedup find_fde' patch: http://sourceware.org/ml/gdb-patches/2009-07/msg00528.html and works around the gold/10400 issue: http://sourceware.org/bugzilla/show_bug.cgi?id=10400 by using the first FDE entry when there are incompatible FDEs "covering" the same code region. The first entry exactly corresponds to the COMDAT section gold actually selected, and is the right one to use. [Gold issue has been fixed, but it will be quite a while before I can pick up that fix, and it would be nice to have a GDB workaround.] Tested on Linux/x86_64 with no new failures. Comments? Thanks, -- Paul Pluzhnikov 2009-07-21 Paul Pluzhnikov gold/10400 * dwarf2-frame.c (qsort_fde_cmp): Use stable sort. Index: src/gdb/dwarf2-frame.c =================================================================== --- src.orig/gdb/dwarf2-frame.c 2009-07-21 16:33:41.000000000 -0700 +++ src/gdb/dwarf2-frame.c 2009-07-21 16:43:46.000000000 -0700 @@ -1955,8 +1955,16 @@ struct dwarf2_fde *aa = *(struct dwarf2_fde **)a; struct dwarf2_fde *bb = *(struct dwarf2_fde **)b; if (aa->initial_location == bb->initial_location) - /* Put eh_frame entries after debug_frame ones. */ - return aa->eh_frame_p - bb->eh_frame_p; + { + if (aa->address_range != bb->address_range + && aa->eh_frame_p == 0 && bb->eh_frame_p == 0) + /* Linker bug, e.g. gold/10400. + Work around it by keeping stable sort order. */ + return (char *) a - (char *) b; + else + /* Put eh_frame entries after debug_frame ones. */ + return aa->eh_frame_p - bb->eh_frame_p; + } return aa->initial_location - bb->initial_location; }