简体   繁体   English

编译器什么时候为x86_64生成间接跳转,用C语言? 我们可以告诉编译器禁用生成间接跳转吗?

[英]When will compiler generate indirect jump for x86_64, in C language? Can we tell compilers to disable generating indirect jumps?

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.据我所知,编译器会为连续的、大的 switch case 代码块、C++ 的虚函数表以及某些尾调用情况生成间接跳转。 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?此外,我们是否可以告诉编译器(首选 clang/llvm)除非必要,否则不要生成间接调用?

The question may be weird as I'm doing some research on this.这个问题可能很奇怪,因为我正在对此进行一些研究。

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).除了切换大小写序列之外,Microsoft 编译器在调试模式下构建时还会生成一组指向函数的指针(我很确定这不是在发布模式下完成的)。 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.还有一个间接调用用于切换上下文(或只是更改权限级别),但这对于普通的 C/C++ 代码应该不是问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM