This is the mail archive of the
mailing list for the GCC project.
Re: [csl-sol210] Patch to add -fno-jump-tables
Joseph S. Myers wrote:
On Mon, 23 May 2005, Joern RENNECKE wrote:
#ifndef ASM_OUTPUT_ADDR_DIFF_ELTThis might not matter as long as you keep this on a sparc-only branch, but
+ || !flag_jump_tables
|| TREE_CONSTANT (index_expr))
index = expand_expr (index_expr, NULL_RTX, VOIDmode, 0);
the !flag_jump_tables check should be inside the #ifndef
Targets like the SH can do casesi expansion just fine without requiring a GOT
Sparc defines ASM_OUTPUT_ADDR_DIFF_ELT - that's why it's not enough for
the dynamic linker to be compiled with -fPIC, because it can still use
jump tables (of differences of addresses) with -fPIC, but not without a
GOT because then the address of the jump table itself cannot be
referenced. The option only makes sense outside the #ifndef, because
inside the #ifndef it would only be used on platforms where -fPIC by
itself disables jump tables.
I see. So the Sparc could actually support pic jump tables without GOT just
fine, if the machine description could pick some other pc-relative value
into the pic_offset_table register instead of the GOT address. E.g. the
data section start symbol.
The flag -fno-jump-tables does what it says - disables jump tables.
There's no need for anyone to use this flag on SH if the flag isn't needed
on SH. Perhaps the documentation should say "On some targets, jump tables
do not require a GOT and this option is not needed."?Yes, that is a possibility, although this is still a rather
oriented approach. It would seem more user-friendly if you had an option
to tell the compiler that there will be no GOT, e.g. -fno-got, and let the
compiler sort out how it needs to modify code generation depending on how
the target can best support pic code in this scenario.