[LLVMdev] Always put jump tables in code section?

Robinson, Paul Paul_Robinson at playstation.sony.com
Thu Aug 8 18:26:30 PDT 2013


Jump tables (e.g. for dispatching in switch statements) currently
get emitted to a readonly data section, unless -fPIC is in effect
in which case they're emitted into the function's code section.
The code to figure this out (in AsmPrinter::EmitJumpTableInfo())
is not obvious, although commented, and has a FIXME for yet another
special case.

There is clear value to co-locating jump tables with the function
body for -fPIC.  I am not so clear on the value of putting them
in a readonly data section in the non-PIC case.  Would it be a
problem if they were always in the function code section?  (And
for dead-stripping purposes, they should be within the bounds of
the function symbol, so they need to be emitted a little earlier
within AsmPrinter::EmitFunctionBody(). No point in having the
jump tables be their own atom, I think.)
--paulr






More information about the llvm-dev mailing list