0

I was looking at the disassembly of some simple code that just defines 5 ints, I looked at the disassembly and saw the normal behaviour of the code popping rbp and storing rsp into rbp but then it directly went into putting the ints into the stack(without subtracting their size from rsp), I don't know if this is normal behaviour since I was always under the impression that it should first allocate the data before storing it, well in this case why did it even bother storing rsp into rbp? rsp wont change so why not just use it as the base pointer directly?

  • 1
    Some compilers are set to use rbp as a frame pointer by default. If you turn that off, e.g. `-fomit-frame-pointer` on gcc or clang, you will probably see rbp no longer used. – Nate Eldredge Oct 16 '20 at 01:03
  • I see, sorry for the duplicate I hate to admit it but I didn't bother looking it up for long! –  Oct 16 '20 at 01:04
  • oh I see, thank you! I'll check it out! :) –  Oct 16 '20 at 01:07

0 Answers0