From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12391 invoked by alias); 30 Aug 2013 15:11:25 -0000 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 Received: (qmail 12381 invoked by uid 89); 30 Aug 2013 15:11:24 -0000 Received: from mms1.broadcom.com (HELO mms1.broadcom.com) (216.31.210.17) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 30 Aug 2013 15:11:24 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.3.2 X-HELO: mms1.broadcom.com Received: from [10.9.208.57] by mms1.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.5)); Fri, 30 Aug 2013 08:07:17 -0700 X-Server-Uuid: 06151B78-6688-425E-9DE2-57CB27892261 Received: from IRVEXCHSMTP2.corp.ad.broadcom.com (10.9.207.52) by IRVEXCHCAS08.corp.ad.broadcom.com (10.9.208.57) with Microsoft SMTP Server (TLS) id 14.1.438.0; Fri, 30 Aug 2013 08:11:11 -0700 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP2.corp.ad.broadcom.com (10.9.207.52) with Microsoft SMTP Server id 14.1.438.0; Fri, 30 Aug 2013 08:11:11 -0700 Received: from [10.177.73.74] (unknown [10.177.73.74]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 4D0CA1A4A for ; Fri, 30 Aug 2013 08:11:10 -0700 (PDT) Message-ID: <5220B60D.2090807@broadcom.com> Date: Fri, 30 Aug 2013 15:11:00 -0000 From: "Andrew Burgess" User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: "gdb-patches@sourceware.org" Subject: [PATCH] gdb.base/code_elim.exp - empty bss issue. Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-08/txt/msg00920.txt.bz2 The gdb.base/code_elim.exp test builds the file gdb.base/code_elim1.c, then runs the following gdb command: (gdb) add-symbol-file /projects/firepath_work/aburgess/upstream-gdb-git/build/gdb/testsuite/gdb.base/code_elim1 0x100000 -s .bss 0x120000 If there's no .bss section then this will issue a warning. On x86-64 Linux building the code_elim1.c file /does/ result in some .bss content, however, non of this content comes from the code_elim1.c source file, it's all from the libraries. On my local embeded target, and I'm guessing possibly other targets, I get no .bss section at all (the test is compiled -fdata-sections and -Wl,-gc-sections), which results in the no .bss warning, and the test failing. I could fix this by either: 1. Check the binary for a .bss before issuing the add-symbol-file command, and not including the "-s .bss " part if it's not needed. 2. Extend the test regexp to allow for the warning. 3. Force the test to generate some .bss content. I chose option #3 but would be happy to rewrite to any of the other options if they were prefered. OK to apply? Thanks, Andrew gdb/ChangeLog 2013-08-30 Andrew Burgess * gdb.base/code_elim1.c (my_bss_symbol): New variable added. (my_static_symbol): Add comment. (main): Reference my_bss_symbol. diff --git a/gdb/testsuite/gdb.base/code_elim1.c b/gdb/testsuite/gdb.base/code_elim1.c index 3de92de..d55284a 100644 --- a/gdb/testsuite/gdb.base/code_elim1.c +++ b/gdb/testsuite/gdb.base/code_elim1.c @@ -17,6 +17,13 @@ int my_global_symbol = 42; +/* Symbol MY_BSS_SYMBOL is referenced, and should be placed into .bss + section. */ + +static int my_bss_symbol; + +/* Symbol MY_STATIC_SYMBOL is never referenced and so will be eliminated. */ + static int my_static_symbol; int @@ -24,7 +31,7 @@ main () { int v_in_main; - return v_in_main; + return v_in_main + my_bss_symbol; } int