Re: [google] Add SECTION_EXCLUDE flag and exclude .gnu.callgraph sections (issue5126041)
I committed the patch to google/gcc-4_6 branch. Thanks, -Sri. * output.h (SECTION_EXCLUDE): New flag for exclude sections. * varasm.c (default_elf_asm_named_section): Add "e" to section flags marked as SECTION_EXCLUDE. * final.c (rest_of_handle_final): Exclude .gnu.callgraph sections. Index: gcc/varasm.c === --- gcc/varasm.c(revision 179288) +++ gcc/varasm.c(working copy) @@ -6191,6 +6191,8 @@ if (!(flags & SECTION_DEBUG)) *f++ = 'a'; + if (flags & SECTION_EXCLUDE) +*f++ = 'e'; if (flags & SECTION_WRITE) *f++ = 'w'; if (flags & SECTION_CODE) Index: gcc/output.h === --- gcc/output.h(revision 179288) +++ gcc/output.h(working copy) @@ -443,6 +443,7 @@ #define SECTION_COMMON 0x80 /* contains common data */ #define SECTION_RELRO 0x100 /* data is readonly after relocation processing */ #define SECTION_MACH_DEP 0x200 /* subsequent bits reserved for target */ +#define SECTION_EXCLUDE 0x400 /* discarded by the linker */ Index: gcc/final.c === --- gcc/final.c (revision 179288) +++ gcc/final.c (working copy) @@ -4428,7 +4428,7 @@ && 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); On Tue, Sep 27, 2011 at 11:02 AM, Cary Coutant wrote: >> 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); > > This part is OK for the google/gcc-4_6 branch. > > -cary >
Re: [google] Add SECTION_EXCLUDE flag and exclude .gnu.callgraph sections (issue5126041)
> 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); This part is OK for the google/gcc-4_6 branch. -cary
Re: [google] Add SECTION_EXCLUDE flag and exclude .gnu.callgraph sections (issue5126041)
Submitted the SECTION_EXCLUDE part to trunk. Thanks, -Sri. On Tue, Sep 27, 2011 at 10:51 AM, Kai Tietz wrote: > > 2011/9/27 Richard Henderson : > > On 09/23/2011 04:45 PM, Sriraman Tallam wrote: > >> I also want the SECTION_EXCLUDE part alone to be considered for trunk. > > > > This is ok for trunk. > > > > Kai, is there a similar flag for pe-coff? I.e. is there something > > reasonable that we can add to i386_pe_asm_named_section? > > Well, pe-coff also has SEC_EXCLUDE. Its meaning is that the section > gets discarded on linking. I checked in gas/config/obj-coff.c and > there is right now AFAICS no way to specify this flag for a section. > But it should be trivial to add it there with specifier 'e'. > > Kai
Re: [google] Add SECTION_EXCLUDE flag and exclude .gnu.callgraph sections (issue5126041)
2011/9/27 Richard Henderson : > On 09/23/2011 04:45 PM, Sriraman Tallam wrote: >> I also want the SECTION_EXCLUDE part alone to be considered for trunk. > > This is ok for trunk. > > Kai, is there a similar flag for pe-coff? I.e. is there something > reasonable that we can add to i386_pe_asm_named_section? Well, pe-coff also has SEC_EXCLUDE. Its meaning is that the section gets discarded on linking. I checked in gas/config/obj-coff.c and there is right now AFAICS no way to specify this flag for a section. But it should be trivial to add it there with specifier 'e'. Kai
Re: [google] Add SECTION_EXCLUDE flag and exclude .gnu.callgraph sections (issue5126041)
On 09/23/2011 04:45 PM, Sriraman Tallam wrote: > I also want the SECTION_EXCLUDE part alone to be considered for trunk. This is ok for trunk. Kai, is there a similar flag for pe-coff? I.e. is there something reasonable that we can add to i386_pe_asm_named_section? r~