Hi!

On Fri, May 07, 2021 at 12:19:50PM +0930, Alan Modra wrote:
> --- a/gcc/varasm.c
> +++ b/gcc/varasm.c
> @@ -6866,6 +6866,26 @@ default_elf_asm_named_section (const char *name, 
> unsigned int flags,
>        *f = '\0';
>      }
>  
> +  char func_label[256];
> +  if (flags & SECTION_LINK_ORDER)
> +    {
> +      static int recur;
> +      if (recur)
> +     gcc_unreachable ();

That is written
  gcc_assert (!recur);
and no "else" after it please.

> +     {
> +       ++recur;
> +       section *save_section = in_section;
> +       static int func_code_labelno;
> +       switch_to_section (function_section (decl));
> +       ++func_code_labelno;
> +       ASM_GENERATE_INTERNAL_LABEL (func_label, "LPFC", func_code_labelno);
> +       ASM_OUTPUT_LABEL (asm_out_file, func_label);
> +       switch_to_section (save_section);
> +       --recur;
> +     }

See the other mail.  You could just write
  recur = true;
etc.?  That avoids unintentionally overflowing as well.

>       {
> -       tree id = DECL_ASSEMBLER_NAME (decl);
> -       ultimate_transparent_alias_target (&id);
> -       const char *name = IDENTIFIER_POINTER (id);
> -       name = targetm.strip_name_encoding (name);
> -       fprintf (asm_out_file, ",%s", name);
> +       fputc (',', asm_out_file);

Please don't use fputc and friends, just use fprintf.  The compiler will
make that fputc if that is a good idea.

Looks good with those things tweaked.


Segher

Reply via email to