diff options
Diffstat (limited to 'gcc/config/avr/avr.c')
-rw-r--r-- | gcc/config/avr/avr.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index fbb96cf..dda7190 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -3206,16 +3206,20 @@ unique_section (decl, reloc) } -/* Output section name to file FILE */ +/* Output section name to file FILE + We make the section read-only and executable for a function decl, + read-only for a const data decl, and writable for a non-const data decl. */ void asm_output_section_name(file, decl, name, reloc) FILE *file; - tree decl ATTRIBUTE_UNUSED; + tree decl; const char *name; int reloc ATTRIBUTE_UNUSED; { - fprintf (file, ".section %s\n", name); + fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", name, \ + decl && TREE_CODE (decl) == FUNCTION_DECL ? "ax" : + decl && TREE_READONLY (decl) ? "a" : "aw"); } |