Senthil Kumar Selvaraj schrieb:
Hi,
This patch fixes PR 71151 by eliminating the
TARGET_ASM_FUNCTION_RODATA_SECTION hook and setting
JUMP_TABLES_IN_TEXT_SECTION to 1.
As described in the bugzilla entry, this hook assumed it will get
called only for jumptable rodata for functions. This was true until
6.1, when a commit in varasm.c started calling the hook for mergeable
string/constant data as well.
This resulted in string constants ending up in a section intended for
jumptables (flash), and broke code using those constants, which
expects them to be present in rodata (SRAM).
Given that the original reason for placing jumptables in a section was
fixed by Johann in PR 63323, this patch restores the original
behavior. Reg testing on both gcc-6-branch and trunk showed no regressions.
As pointed out by Johann, this may end up increasing code
size if there are lots of branches that cross the jump tables. I
intend to propose a separate patch that gives additional information
to the target hook (SECCAT_RODATA_{STRING,JUMPTABLE}) so it can know
what type of function rodata is coming on. Johann also suggested
handling jump table generation ourselves - I'll experiment with that
some more.
If ok, could someone commit please? Could you also backport to
gcc-6-branch?
Regards
Senthil
gcc/ChangeLog
2016-06-03 Senthil Kumar Selvaraj <senthil_kumar.selva...@atmel.com>
Missing PR target/71151
* config/avr/avr.c (avr_asm_function_rodata_section): Remove.
* config/avr/avr.c (TARGET_ASM_FUNCTION_RODATA_SECTION): Remove.
gcc/testsuite/ChangeLog
2016-06-03 Senthil Kumar Selvaraj <senthil_kumar.selva...@atmel.com>
Missing PR target/71151
* gcc/testsuite/gcc.target/avr/pr71151-1.c: New.
* gcc/testsuite/gcc.target/avr/pr71151-2.c: New.
With the PR entry in the ChangeLog / commit message it might be easier
to find the change, and the respective bugzilla PR will get an automatic
entry pointing to the commit.
Thanks, Johann