This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Make mergeable read-only sections per-function, if requested.
- From: Marek Polacek <polacek at redhat dot com>
- To: Segher Boessenkool <segher at kernel dot crashing dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 7 May 2015 10:15:08 +0200
- Subject: Re: [PATCH] Make mergeable read-only sections per-function, if requested.
- Authentication-results: sourceware.org; auth=none
- References: <8f67f9aad3d5b98cb428dea0316a86615b89adb9 dot 1430937961 dot git dot segher at kernel dot crashing dot org>
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