From patchwork Fri Sep 23 23:45:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriraman Tallam X-Patchwork-Id: 116200 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id D1B4BB6F77 for ; Sat, 24 Sep 2011 09:46:15 +1000 (EST) Received: (qmail 5704 invoked by alias); 23 Sep 2011 23:46:13 -0000 Received: (qmail 5695 invoked by uid 22791); 23 Sep 2011 23:46:13 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 23 Sep 2011 23:45:56 +0000 Received: from wpaz17.hot.corp.google.com (wpaz17.hot.corp.google.com [172.24.198.81]) by smtp-out.google.com with ESMTP id p8NNjsps000942; Fri, 23 Sep 2011 16:45:54 -0700 Received: from azwildcat.mtv.corp.google.com (azwildcat.mtv.corp.google.com [172.18.110.231]) by wpaz17.hot.corp.google.com with ESMTP id p8NNjqhe030444; Fri, 23 Sep 2011 16:45:52 -0700 Received: by azwildcat.mtv.corp.google.com (Postfix, from userid 69128) id 68D7CB2195; Fri, 23 Sep 2011 16:45:52 -0700 (PDT) To: reply@codereview.appspotmail.com, ccoutant@google.com, gcc-patches@gcc.gnu.org Subject: [google] Add SECTION_EXCLUDE flag and exclude .gnu.callgraph sections (issue5126041) Message-Id: <20110923234552.68D7CB2195@azwildcat.mtv.corp.google.com> Date: Fri, 23 Sep 2011 16:45:52 -0700 (PDT) From: tmsriram@google.com (Sriraman Tallam) X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch adds a new flag to mark sections as exclude sections. Such sections will be discarded by the linker. Also, mark .gnu.callgraph sections which store the callgraph edge profile info as exclude sections. I also want the SECTION_EXCLUDE part alone to be considered for trunk. --- This patch is available for review at http://codereview.appspot.com/5126041 Index: final.c =================================================================== --- final.c (revision 179104) +++ final.c (working copy) @@ -4428,7 +4428,7 @@ rest_of_handle_final (void) && cgraph_node (current_function_decl) != NULL && (cgraph_node (current_function_decl))->callees != NULL) { - flags = SECTION_DEBUG; + flags = SECTION_DEBUG | SECTION_EXCLUDE; asprintf (&profile_fnname, ".gnu.callgraph.text.%s", fnname); switch_to_section (get_section (profile_fnname, flags, NULL)); fprintf (asm_out_file, "\t.string \"Function %s\"\n", fnname); Index: varasm.c =================================================================== --- varasm.c (revision 179098) +++ varasm.c (working copy) @@ -6191,6 +6191,8 @@ default_elf_asm_named_section (const char *name, u if (!(flags & SECTION_DEBUG)) *f++ = 'a'; + if (flags & SECTION_EXCLUDE) + *f++ = 'e'; if (flags & SECTION_WRITE) *f++ = 'w'; if (flags & SECTION_CODE) Index: output.h =================================================================== --- output.h (revision 179098) +++ output.h (working copy) @@ -443,6 +443,7 @@ extern void no_asm_to_stream (FILE *); #define SECTION_COMMON 0x800000 /* contains common data */ #define SECTION_RELRO 0x1000000 /* data is readonly after relocation processing */ #define SECTION_MACH_DEP 0x2000000 /* subsequent bits reserved for target */ +#define SECTION_EXCLUDE 0x4000000 /* discarded by the linker */ /* This SECTION_STYLE is used for unnamed sections that we can switch to using a special assembler directive. */