This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/71151] [avr] -fmerge-constants and -fdata-sections/-ffunction-sections results in string constants in .progmem.gcc_sw section
- From: "gjl at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 01 Jun 2016 14:23:44 +0000
- Subject: [Bug target/71151] [avr] -fmerge-constants and -fdata-sections/-ffunction-sections results in string constants in .progmem.gcc_sw section
- Auto-submitted: auto-generated
- References: <bug-71151-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71151
--- Comment #10 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Well, then we should remove TARGET_ASM_FUNCTION_RODATA_SECTION implementation
altogether (it's weird, not only because it patches flag_data_sections), same
for ASM_OUTPUT_ADDR_VEC_ELT.
Instead implement ASM_OUTPUT_ADDR_VEC and do the whole addr_vec stuff by hand:
1) switch to correct section: if -ffunction-sections is on, cook up a section
like .progmem.gcc_sw_table.<function-asm-name>, otherwise just
.progmem.gcc_sw_table
1) Alternatively, just emit .pushsection and .popsection around the jump table.
2) Output alignment .p2align. The original alignment from
ASM_OUTPUT_BEFORE_CASE_LABEL might be too early (wrong section), so that the
alignment must be output again. ASM_OUTPUT_BEFORE_CASE_LABEL is no more
needed.
3) Output the jump table, see final.c for how to iterate.
Anyway, we might consider putting the jump table into .text section. Since
PR63223 we can handle jump-tables at any location, there is no need for having
it in .progmem (which is supposed to reside in the lowest 64k). And for Tiny
targets, where .rodata is the best place, JUMP_TABLES_IN_TEXT_SECTION can just
return 0.