Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is an extra jmp used for a function call? [duplicate]

imagine this bogus program:

void foo ( void )
{
    // anything
}

int main ()
{
    foo ();
    return 0;
}

When compiled in debug mode with Visual Studio, the compiler builds some kind of "function map" or however it is called.

Thus when you for example follow foo () in a debugger, or just try to retrieve the offset of the function via &foo, you find yourself in a "list" of jmp's, which will when you follow them again lead you to the actual function body.

My question is: Is there a possibility to disable this for single choosen functions so that &foo returns the address to the function body, not the jmp. Ofcourse without disabling debug mode.

If not, which flag enables/disables this for the entire program ?

Thanks in advance !

Edit for user SigTerm: enter image description here

like image 963
Andy Avatar asked Jun 02 '12 01:06

Andy


1 Answers

Turn off "incremental linking"

Your question is a lot like this one Address of function is not actual code address

like image 95
dsmtoday Avatar answered Oct 11 '22 18:10

dsmtoday