I'm using at&t ordering I came across this a little while ago and while i understand why we want to push a stack frame when we call a new routine I don't see why it was done here: (for the example i'm looking at static code and the jmp address is just an example and arbritrary)
pushq %rbp movq %rsp, %rbp pop %rbp jmp $0x10002135a nopw(%rax, %rax)
so It turns out the next instruction after the nop is a new function entry so I surmise the nop stuff was done to achieve some sort of alignment. When I go and look at the jumped address I get a real stack frame (standard series of pushes, register saves, etc and at the end of the function standard pops and does the retq.
What did we gain by doing the push/pop sequence?
The only thing i can think of is because it does the pop before the jump is that when the other does the retq it might be returning to the rbp prior to this little bit of code. It's as if this little bit of jmp code never existed? if so why have this little bit of code here in the first place? Or perhaps at runtime the jmp address will occupy more bytes and spill into the nopw area? just guessing.
It almost looks like its a template or a macro that is doing nothing since the pop is restoring the original base pointer that was saved. Or is this more along the lines of the compiler trying to get things aligned?
We got to this point via a jmp.