From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 33168 invoked by alias); 7 May 2015 08:15:20 -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 33142 invoked by uid 89); 7 May 2015 08:15:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_50,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 07 May 2015 08:15:17 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 2B0F38E3E6; Thu, 7 May 2015 08:15:12 +0000 (UTC) Received: from redhat.com (ovpn-204-66.brq.redhat.com [10.40.204.66]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t478F8RQ028808 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Thu, 7 May 2015 04:15:11 -0400 Date: Thu, 07 May 2015 08:15:00 -0000 From: Marek Polacek To: Segher Boessenkool Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Make mergeable read-only sections per-function, if requested. Message-ID: <20150507081507.GA3384@redhat.com> References: <8f67f9aad3d5b98cb428dea0316a86615b89adb9.1430937961.git.segher@kernel.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8f67f9aad3d5b98cb428dea0316a86615b89adb9.1430937961.git.segher@kernel.crashing.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-05/txt/msg00518.txt.bz2 On Wed, May 06, 2015 at 03:59:33PM -0700, Segher Boessenkool wrote: > Currently GCC does not put mergeable read-only data in a per-function > section, so the -gc-sections linker option does not do much for such > data. Fix that. Dunno if it is a good idea, but... > diff --git a/gcc/varasm.c b/gcc/varasm.c > index 62d5163..d8f077d 100644 > --- a/gcc/varasm.c > +++ b/gcc/varasm.c > @@ -783,6 +783,16 @@ default_no_function_rodata_section (tree decl ATTRIBUTE_UNUSED) > return readonly_data_section; > } > > +const char * > +function_mergeable_rodata_prefix (void) This function needs a comment. > +{ > + section *s = targetm.asm_out.function_rodata_section (current_function_decl); > + if (SECTION_STYLE (s) == SECTION_NAMED) > + return s->named.name; > + else > + return targetm.asm_out.mergeable_rodata_prefix; else is wrongly formatted. Marek