This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: Fix FRV switch table generation in PIC mode
Hi Richard,
Basically, why the motivation for JUMP_TABLES_IN_TEXT_SECTION?
It looks left over from a copy from mips16 code, where there
was in fact a justification.
You are right. The JUMP_TABLES_IN_TEXT_SECTION is not needed. Attached
is a revised patch which just deletes the ASM_OUTPUT_ADDR_DIFF_ELT and
ASM_OUTPUT_CASE_LABEL macros which were causing the problems.
I have checked the patch by rebuilding ld.so using an frv-linux-gnu
toolchain and then getting a co-worker to run it for me, and also by
building an frv-elf toolchain and checking for gcc testsuite regressions
(there were none).
So what do you think, is this version OK ?
Cheers
Nick
gcc/ChangeLog
2007-02-23 Nick Clifton <nickc@redhat.com>
* config/frv/frv.h: Remove hold-overs from copying this backend
from the mips16 port. Fixes the implementation of switch tables
when compiling in pic mode.
(ASM_OUTPUT_ADDR_DIFF_ELT): Delete.
(ASM_OUTPUT_CASE_LABEL): Delete/
Index: gcc/config/frv/frv.h
===================================================================
--- gcc/config/frv/frv.h (revision 122252)
+++ gcc/config/frv/frv.h (working copy)
@@ -2571,19 +2571,6 @@ do { \
/* Output of dispatch tables. */
/* This macro should be provided on machines where the addresses in a dispatch
- table are relative to the table's own address.
-
- The definition should be a C statement to output to the stdio stream STREAM
- an assembler pseudo-instruction to generate a difference between two labels.
- VALUE and REL are the numbers of two internal labels. The definitions of
- these labels are output using `(*targetm.asm_out.internal_label)', and they must be
- printed in the same way here. For example,
-
- fprintf (STREAM, "\t.word L%d-L%d\n", VALUE, REL) */
-#define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \
-fprintf (STREAM, "\t.word .L%d-.L%d\n", VALUE, REL)
-
-/* This macro should be provided on machines where the addresses in a dispatch
table are absolute.
The definition should be a C statement to output to the stdio stream STREAM
@@ -2594,34 +2581,6 @@ fprintf (STREAM, "\t.word .L%d-.L%d\n",
fprintf (STREAM, "\t.word L%d\n", VALUE) */
#define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
fprintf (STREAM, "\t.word .L%d\n", VALUE)
-
-/* Define this if the label before a jump-table needs to be output specially.
- The first three arguments are the same as for `(*targetm.asm_out.internal_label)';
- the fourth argument is the jump-table which follows (a `jump_insn'
- containing an `addr_vec' or `addr_diff_vec').
-
- This feature is used on system V to output a `swbeg' statement for the
- table.
-
- If this macro is not defined, these labels are output with
- `(*targetm.asm_out.internal_label)'.
-
- Defined in svr4.h. */
-/* When generating embedded PIC or mips16 code we want to put the jump
- table in the .text section. In all other cases, we want to put the
- jump table in the .rdata section. Unfortunately, we can't use
- JUMP_TABLES_IN_TEXT_SECTION, because it is not conditional.
- Instead, we use ASM_OUTPUT_CASE_LABEL to switch back to the .text
- section if appropriate. */
-
-#undef ASM_OUTPUT_CASE_LABEL
-#define ASM_OUTPUT_CASE_LABEL(STREAM, PREFIX, NUM, TABLE) \
-do { \
- if (flag_pic) \
- switch_to_section (function_section (current_function_decl)); \
- (*targetm.asm_out.internal_label) (STREAM, PREFIX, NUM); \
-} while (0)
-
/* Assembler Commands for Exception Regions. */