[Patch,AVR]: PR18145: do_copy_data & do_clear_bss only if needed

Richard Henderson rth@redhat.com
Tue Apr 19 20:02:00 GMT 2011


On 04/18/2011 10:20 AM, Georg-Johann Lay wrote:
> +avr_asm_named_section (const char *name, unsigned int flags, tree decl)
> +{
> +  if (!avr_need_copy_data_p)
> +    avr_need_copy_data_p = ((0 == strncmp (name, ".data", 5)
> +                             || 0 == strncmp (name, ".rodata", 7)
> +                             || 0 == strncmp (name, ".gnu.linkonce.", 14)));
> +  
> +  if (!avr_need_clear_bss_p)
> +    avr_need_clear_bss_p = (0 == strncmp (name, ".bss", 4));

Have a look at FLAGS.  I expect that you can reference those to
categorize the data rather than hard-coding the section names.
In particular I believe your ".gnu.linkonce" test is wrong.

It's not clear to me what you're looking for wrt "data".
Perhaps what you want is

  if (flags & (SECTION_DEBUG | SECTION_CODE))
    ;
  else if (flags & SECTION_BSS)
    avr_need_clear_bss_p = true;
  else
    avr_need_copy_data_p = true;


r~



More information about the Gcc-patches mailing list