0
votes

As I know, the compiler would generate indirect jump for continuous, large switch case code block, virtual function table for C++, and in some tail call situation. Also, indirect calls (not jump) for pointers to functions. Any other situations to use indirect jump?

Additionally, can we tell compiler (clang/llvm preferred) not to generate indirect calls unless necessary?

The question may be weird as I'm doing some research on this.

1
Using indirect jump is never neccessary. In a pinch, one can replace it with push-ing the target-address and then doing a return. Inefficient, but anyway.Deduplicator
Any way to replace it with a direct jump or something that could be determined before running?WindChaser

1 Answers

-1
votes

Indirect jumps or calls normally involve an array of pointers (address). In addition to switch case sequences, Microsoft compilers generate an array of pointers to functions when building in debug mode (I'm pretty sure this isn't done in release mode). I don't know how to disable it. There's also an indirect call used to switch context (or just change privilege level), but that shouldn't be an issue for normal C / C++ code.