Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(10097)

Issue 9025045: [google] Add function name to function_patch_* sections

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 12 months ago by harshit
Modified:
10 years, 12 months ago
Reviewers:
davidxl
CC:
gcc-patches_gcc.gnu.org, Sriraman
Visibility:
Public.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+16 lines, -2 lines) Patch
M gcc/config/i386/i386.c View 3 chunks +16 lines, -2 lines 0 comments Download

Messages

Total messages: 3
harshit
Adding function name to the function_patch_* sections when -ffunction-sections is provided. Helps in garbage collecting ...
10 years, 12 months ago (2013-04-30 20:53:46 UTC) #1
davidxl
ok. David On Tue, Apr 30, 2013 at 1:34 PM, Harshit Chopra <harshit@google.com> wrote: > ...
10 years, 12 months ago (2013-04-30 23:38:13 UTC) #2
harshit
10 years, 12 months ago (2013-05-01 00:23:23 UTC) #3
Thanks for the review. Submitted as r198485.


--
Harshit


On Tue, Apr 30, 2013 at 4:38 PM, Xinliang David Li <davidxl@google.com>wrote:

> ok.
>
> David
>
> On Tue, Apr 30, 2013 at 1:34 PM, Harshit Chopra <harshit@google.com>
> wrote:
> > Adding function name to the function_patch_* sections when
> -ffunction-sections is provided. Helps in garbage collecting dead functions
> with the help of linker.
> >
> > Tested:
> >   Tested using 'make -k check-gcc RUNTESTFLAGS="i386.exp=patch*
> --target_board=unix\{-m32,,-m64\}"'.
> >
> > 2013-04-30  Harshit Chopra  <harshit@google.com>
> >
> >         * gcc/config/i386/i386.c
> (ix86_output_function_nops_prologue_epilogue):
> >         (ix86_elf_asm_named_section):
> >
> > diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
> > index aa6ec82..7cb832b 100644
> > --- a/gcc/config/i386/i386.c
> > +++ b/gcc/config/i386/i386.c
> > @@ -11285,6 +11285,8 @@ ix86_output_function_nops_prologue_epilogue
> (FILE *file,
> >    unsigned int section_flags = SECTION_RELRO;
> >    char *section_name_comdat = NULL;
> >    const char *decl_section_name = NULL;
> > +  const char *func_name = NULL;
> > +  char *section_name_function_sections = NULL;
> >    size_t len;
> >
> >    gcc_assert (num_remaining_nops >= 0);
> > @@ -11336,12 +11338,24 @@ ix86_output_function_nops_prologue_epilogue
> (FILE *file,
> >      {
> >        decl_section_name =
> >            TREE_STRING_POINTER (DECL_SECTION_NAME
> (current_function_decl));
> > -      len = strlen (decl_section_name) + strlen (section_name) + 1;
> > +      len = strlen (decl_section_name) + strlen (section_name) + 2;
> >        section_name_comdat = (char *) alloca (len);
> >        sprintf (section_name_comdat, "%s.%s", section_name,
> decl_section_name);
> >        section_name = section_name_comdat;
> >        section_flags |= SECTION_LINKONCE;
> >      }
> > +  else if (flag_function_sections)
> > +    {
> > +      func_name = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
> > +      if (func_name)
> > +        {
> > +          len = strlen (func_name) + strlen (section_name) + 2;
> > +          section_name_function_sections = (char *) alloca (len);
> > +          sprintf (section_name_function_sections, "%s.%s",
> section_name,
> > +                   func_name);
> > +          section_name = section_name_function_sections;
> > +        }
> > +    }
> >    section = get_section (section_name, section_flags,
> current_function_decl);
> >    switch_to_section (section);
> >    /* Align the section to 8-byte boundary.  */
> > @@ -11369,7 +11383,7 @@ ix86_elf_asm_named_section (const char *name,
> unsigned int flags,
> >                              tree decl)
> >  {
> >    const char *section_name = name;
> > -  if (HAVE_COMDAT_GROUP && flags & SECTION_LINKONCE)
> > +  if (!flag_function_sections && HAVE_COMDAT_GROUP && flags &
> SECTION_LINKONCE)
> >      {
> >        const int prologue_section_name_length =
> >            sizeof(FUNCTION_PATCH_PROLOGUE_SECTION) - 1;
> >
> > --
> > This patch is available for review at
> http://codereview.appspot.com/9025045
>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b