6

I have the below program for an x64 build:

void f1()
{
    printf_s("in f1()\n");
}

void main(int argc, char** argv)
{

    f1();
}

I run it in Visual Studio 2015 with F5 debug run. And check the disassembly code:

extra jmp in red rectangle

Why is there an unconditional jmp in the red rectangle?

Is it possible to disable it?

Boann
  • 48,794
  • 16
  • 117
  • 146
smwikipedia
  • 61,609
  • 92
  • 309
  • 482
  • 11
    It is a table of jmp thunks to support incremental linking (patching). https://learn.microsoft.com/en-us/cpp/build/reference/incremental-link-incrementally?view=vs-2019 – Michael Petch May 08 '19 at 08:03
  • 1
    Is that debug-mode with incremental build or something? Also, you should label your screenshots, e.g. that the first one is the call to `f1()` *from main*. And more importantly, copy/paste text not pictures of text. You're not including raw machine code so I had to work out from the address that it was a 5-byte `jmp` and thus a `jmp rel32` direct jump, rather than a memory-indirect `jmp [rel function_pointer]` or something as a DLL wrapper stub. – Peter Cordes May 08 '19 at 08:03
  • @PeterCordes Thanks for the reminding. I post it in a haste and thought it is not very obscure. Updated now. – smwikipedia May 08 '19 at 08:36
  • 1
    @MichaelPetch, please turn your comment into a solution so it can better be searched for and archived. – Paul Ogilvie May 08 '19 at 08:42
  • @PaulOgilvie: Or you could have googled `jmp thunks to support incremental linking` and found one of the duplicates like I did, using Michael's phrasing for a google search :P – Peter Cordes May 08 '19 at 08:52
  • 1
    With VS 2005 through VS 2015, taking the defaults for a release build eliminates the jumps. I don't know about VS 2017 or VS 2019. – rcgldr May 08 '19 at 13:00

0 Answers0