View | Details | Raw Unified | Return to bug 71151
Collapse All | Expand All

(-)gcc/config/avr/avr.c (+21 lines)
Lines 9734-9739 avr_asm_select_section (tree decl, int reloc, unsigned HOST_WIDE_INT align) Link Here
9734
9734
9735
      return progmem_section[as];
9735
      return progmem_section[as];
9736
    }
9736
    }
9737
    /* HACK: If it's not a progmem decl, overrule sect returned by
9738
       default_elf_select_section, as it causes string constants in
9739
       functions to go into flash (see PR 71151). Replicate whatever
9740
       mergeable_string/constant_section does, but with the prefix
9741
       corrected to rodata. */
9742
    else if (decl_readonly_section (decl, reloc)
9743
             && SECTION_STYLE (sect) == SECTION_NAMED
9744
             && (sect->common.flags & SECTION_MERGE))
9745
    {
9746
        const char * old_prefix = ".progmem.gcc_sw_table";
9747
        const char * new_prefix = ".rodata";
9748
        const char * name = sect->named.name;
9749
9750
        if (STR_PREFIX_P (name, old_prefix))
9751
        {
9752
          const char *rname = ACONCAT ((new_prefix,
9753
                                        name + strlen (old_prefix), NULL));
9754
9755
          return get_section (rname, sect->common.flags, NULL);
9756
        }
9757
    }
9737
9758
9738
  return sect;
9759
  return sect;
9739
}
9760
}

Return to bug 71151