From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 56747 invoked by alias); 30 Apr 2015 07:13:55 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 56736 invoked by uid 89); 30 Apr 2015 07:13:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-oi0-f49.google.com Received: from mail-oi0-f49.google.com (HELO mail-oi0-f49.google.com) (209.85.218.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 30 Apr 2015 07:13:52 +0000 Received: by oift201 with SMTP id t201so41163658oif.3 for ; Thu, 30 Apr 2015 00:13:50 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.202.10.193 with SMTP id 184mr2225328oik.90.1430378030879; Thu, 30 Apr 2015 00:13:50 -0700 (PDT) Received: by 10.76.95.133 with HTTP; Thu, 30 Apr 2015 00:13:50 -0700 (PDT) In-Reply-To: References: <5519B12F.6000508@codesourcery.com> Date: Thu, 30 Apr 2015 07:19:00 -0000 Message-ID: Subject: Re: [PATCH] Fix for PR26702: Emit .size for BSS variables on arm-eabi From: "Bin.Cheng" To: ramrad01@arm.com Cc: Kwok Cheung Yeung , GCC Patches Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg01971.txt.bz2 On Thu, Apr 23, 2015 at 10:51 PM, Ramana Radhakrishnan wrote: > On Mon, Mar 30, 2015 at 9:25 PM, Kwok Cheung Yeung wrote: >> This is a simple patch that ensures that a .size directive is emitted when >> space is allocated for a static variable in the BSS on bare-metal ARM >> targets. This allows other tools such as GDB to look up the size of the >> object correctly. >> >> Before: >> >> $ readelf -s pr26702.o >> >> Symbol table '.symtab' contains 10 entries: >> Num: Value Size Type Bind Vis Ndx Name >> ... >> 6: 00000000 0 NOTYPE LOCAL DEFAULT 3 static_foo >> ... >> >> After: >> >> $ readelf -s pr26702.o >> >> Symbol table '.symtab' contains 10 entries: >> Num: Value Size Type Bind Vis Ndx Name >> ... >> 6: 00000000 4 NOTYPE LOCAL DEFAULT 3 static_foo >> ... >> >> The testsuite has been run with a i686-pc-linux-gnu hosted cross-compiler >> targetted at arm-none-eabi with no regressions. >> >> Kwok >> >> >> 2015-03-30 Kwok Cheung Yeung >> >> gcc/ >> PR target/26702 >> * config/arm/unknown-elf.h (ASM_OUTPUT_ALIGNED_DECL_LOCAL): Emit >> size of local. >> >> gcc/testsuite/ >> PR target/26702 >> * gcc.target/arm/pr26702.c: New test. >> >> Index: gcc/testsuite/gcc.target/arm/pr26702.c >> =================================================================== >> --- gcc/testsuite/gcc.target/arm/pr26702.c (revision 0) >> +++ gcc/testsuite/gcc.target/arm/pr26702.c (revision 0) >> @@ -0,0 +1,4 @@ >> +/* { dg-do compile { target arm*-*-eabi* } } */ >> +/* { dg-final { scan-assembler "\\.size\[\\t \]+static_foo, 4" } } */ >> +int foo; >> +static int static_foo; >> Index: gcc/config/arm/unknown-elf.h >> =================================================================== >> --- gcc/config/arm/unknown-elf.h (revision 447549) >> +++ gcc/config/arm/unknown-elf.h (working copy) >> @@ -81,6 +81,8 @@ >> ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT)); \ >> ASM_OUTPUT_LABEL (FILE, NAME); \ >> fprintf (FILE, "\t.space\t%d\n", SIZE ? (int)(SIZE) : 1); >> \ >> + fprintf (FILE, "\t.size\t%s, %d\n", \ >> + NAME, SIZE ? (int)(SIZE) : 1); \ >> } \ >> while (0) >> > > > Now applied as attached with the following modifications. > > Sorry about the delay - I've been away for a bit and couldn't attend > to committing this. Hi Kwok, The newly introduced test case failed on arm-none-linux-gnueabi&arm-none-linux-gnueabihf. Could you please have a look at it? FAIL: gcc.target/arm/pr26702.c scan-assembler \\.size[\\t ]+static_foo, 4 PR65937 is filed for tracking this. Thanks, bin > > Thanks > Ramana