This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [csl-sol210] Patch to add -fno-jump-tables

Joseph S. Myers wrote:

On Mon, 23 May 2005, Joern RENNECKE wrote:

|| flag_pic
+ || !flag_jump_tables
|| TREE_CONSTANT (index_expr))
index = expand_expr (index_expr, NULL_RTX, VOIDmode, 0);

This might not matter as long as you keep this on a sparc-only branch, but
the !flag_jump_tables check should be inside the #ifndef
Targets like the SH can do casesi expansion just fine without requiring a GOT
for that.

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 to load
into the pic_offset_table register instead of the GOT address. E.g. the read only
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 compiler-implementer
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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]