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.

Reply via email to